Bug#1012364: Please add support for systemd-binfmt
Michael Biebl
biebl at debian.org
Sun Jun 5 19:14:08 BST 2022
Package: llvm-11-runtime
Version: 1:11.1.0-6+b2
Severity: wishlist
Tags: patch
User: pkg-systemd-maintainers at lists.alioth.debian.org
Usertags: systemd-binfmt
Hi,
your package llvm-11-runtime declares a dependency (Recommends) on
binfmt-support and ships binfmt-support configuration files in
/usr/share/binfmts/.
systemd provides a builtin, cross-distro facility named systemd-binfmt to
register binary formats.
You can read more about it at
https://www.freedesktop.org/software/systemd/man/systemd-binfmt.html
https://www.freedesktop.org/software/systemd/man/binfmt.d.html
https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.html
The systemd package provides a dpkg file trigger so it is sufficient to
simply install configuration files in /usr/lib/binfmt.d/, no
modifications in the maintainer scripts are necessary.
The attached patch adds support for systemd-binfmt and adjusts the
dependency on binfmt-support accordingly, so binfmt-support is no longer
installed automatically if systemd is already available.
It also updates the autopkgtest suite to no longer require
binfmt-support.
Regards,
Michael
-- System Information:
Debian Release: bookworm/sid
APT prefers unstable
APT policy: (500, 'unstable'), (200, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 5.17.0-3-amd64 (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_FIRMWARE_WORKAROUND
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages llvm-11-runtime depends on:
ii libc6 2.33-7
ii libgcc-s1 12.1.0-2
ii libllvm11 1:11.1.0-6+b2
ii libstdc++6 12.1.0-2
ii libtinfo6 6.3+20220423-2
ii libz3-4 4.8.12-1+b1
ii zlib1g 1:1.2.11.dfsg-4
Versions of packages llvm-11-runtime recommends:
ii binfmt-support 2.2.2-1
llvm-11-runtime suggests no packages.
-- no debconf information
-------------- next part --------------
diff --git a/debian/control b/debian/control
index fe6f47af..384d1656 100644
--- a/debian/control
+++ b/debian/control
@@ -329,7 +329,7 @@ Description: Modular compiler and toolchain technologies
Package: llvm-11-runtime
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
-Recommends: binfmt-support
+Recommends: binfmt-support | systemd
Description: Modular compiler and toolchain technologies, IR interpreter
LLVM is a collection of libraries and tools that make it easy to build
compilers, optimizers, just-in-time code generators, and many other
diff --git a/debian/llvm-X.Y-runtime.binfmt.conf.in b/debian/llvm-X.Y-runtime.binfmt.conf.in
new file mode 100644
index 00000000..9f712796
--- /dev/null
+++ b/debian/llvm-X.Y-runtime.binfmt.conf.in
@@ -0,0 +1 @@
+:llvm- at LLVM_VERSION@-runtime.binfmt:M::BC::/usr/bin/lli- at LLVM_VERSION@:
diff --git a/debian/llvm-X.Y-runtime.install.in b/debian/llvm-X.Y-runtime.install.in
index d8e16a7c..fde07b98 100644
--- a/debian/llvm-X.Y-runtime.install.in
+++ b/debian/llvm-X.Y-runtime.install.in
@@ -5,4 +5,5 @@ usr/bin/lli- at LLVM_VERSION@
usr/bin/lli-child-target- at LLVM_VERSION@
debian/llvm- at LLVM_VERSION@-runtime.binfmt usr/share/binfmts/
+debian/llvm- at LLVM_VERSION@-runtime.binfmt.conf usr/lib/binfmt.d/
diff --git a/debian/qualify-clang.sh b/debian/qualify-clang.sh
index b385815b..9772e0ce 100755
--- a/debian/qualify-clang.sh
+++ b/debian/qualify-clang.sh
@@ -294,9 +294,7 @@ fi
clang-$VERSION -O3 -emit-llvm foo.c -c -o foo.bc
chmod +x foo.bc
# only run if the binfmt is installed correctly
-/usr/sbin/update-binfmts --display llvm-$VERSION-runtime.binfmt &> foo.log || true
-if grep -q "interpreter = /usr/bin/lli-" foo.log; then
- /usr/sbin/update-binfmts --enable llvm-$VERSION-runtime.binfmt || true
+if grep -q "enabled" /proc/sys/fs/binfmt_misc/llvm-${VERSION}-runtime.binfmt; then
if ! ./foo.bc|grep -q "lli foo"; then
echo "executing ./foo.bc failed"
./foo.bc || true
diff --git a/debian/tests/control b/debian/tests/control
index 38411379..07d1861c 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,5 +1,5 @@
Test-Command: bash -v ./debian/qualify-clang.sh
-Depends: @, cmake, make, g++, file, dpkg-dev, binfmt-support
+Depends: @, cmake, make, g++, file, dpkg-dev
# Comment the dbgsym package because of bug #917528
# dbgsym packages not being available in testing
# clang-11-dbgsym, libclang1-11-dbgsym
More information about the Pkg-llvm-team
mailing list