Bug#1078706: lintian: report an error when a package installs a file into an aliased location (merged-/usr, /usr-move, DEP17)
Source: lintian
Version: 2.118.0
Tags: patch
User: helmutg@debian.org
Usertags: dep17m2
Hi lintian maintainers,
I am proposing the addition of a new lintian-tag "aliased-location" that
is to be emitted for the inclusion of any file below one of the
locations /bin, /lib* or /sbin as only base-files should carry the
relevant aliasing links and all other packages should move their files
as part of the /usr-move transition. At this time, we're below 100
offending source package all of which have a bug report at rc severity.
We have a pending policy change making this mandatory. Consequently, I
am proposing a check for lintian and attaching a patch.
I note that I cannot currently test the patch as lintian fails to build
from source. I have filed a separate bug about that. Also note that I am
removing the subdir-in-bin tag, because any affected file emits
aliased-location with my patch and subdirectories are allowed in
/usr/bin, so this tag can no longer be emitted.
Please let me know if you have any questions regarding the transition or
the patch.
Helmut
diff --minimal -Nru lintian-2.118.0/debian/changelog lintian-2.118.0+nmu1/debian/changelog
--- lintian-2.118.0/debian/changelog 2024-07-30 11:21:17.000000000 +0200
+++ lintian-2.118.0+nmu1/debian/changelog 2024-08-14 12:45:47.000000000 +0200
@@ -1,3 +1,13 @@
+lintian (2.118.0+nmu1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Add aliased-location tag to support /usr-move (Closes: #-1)
+ * Delete tag subdir-in-bin: Installing anything in bin/ causes the
+ emission of aliased-location now and subdirectories in usr/bin/ are
+ actually allowed.
+
+ -- Helmut Grohne <helmut@subdivi.de> Wed, 14 Aug 2024 12:45:47 +0200
+
lintian (2.118.0) unstable; urgency=medium
* Retroactively add missing entry to the 2.117.1 changelog entry
diff --minimal -Nru lintian-2.118.0/lib/Lintian/Check/Files/Hierarchy/Standard.pm lintian-2.118.0+nmu1/lib/Lintian/Check/Files/Hierarchy/Standard.pm
--- lintian-2.118.0/lib/Lintian/Check/Files/Hierarchy/Standard.pm 2022-08-13 15:53:35.000000000 +0200
+++ lintian-2.118.0+nmu1/lib/Lintian/Check/Files/Hierarchy/Standard.pm 2024-08-14 12:45:47.000000000 +0200
@@ -184,10 +184,10 @@
# /mnt
$self->pointed_hint('dir-or-file-in-mnt', $item->pointer);
- } elsif ($item->name =~ m{^bin/}) {
- # /bin
- $self->pointed_hint('subdir-in-bin', $item->pointer)
- if $item->is_dir && $item->name =~ m{^bin/.};
+ } elsif ($item->name =~ m{^(bin|lib[a-z0-9]*|sbin)($|/)}
+ && $self->processable->name ne 'base-files') {
+ # Aliased file
+ $self->pointed_hint('aliased-location', $item->pointer);
} elsif ($item->name =~ m{^srv/.}) {
# /srv
diff --minimal -Nru lintian-2.118.0/t/recipes/checks/files/hierarchy/standard/files-foo-in-bar/build-spec/debian/dirs lintian-2.118.0+nmu1/t/recipes/checks/files/hierarchy/standard/files-foo-in-bar/build-spec/debian/dirs
--- lintian-2.118.0/t/recipes/checks/files/hierarchy/standard/files-foo-in-bar/build-spec/debian/dirs 2021-09-04 16:23:12.000000000 +0200
+++ lintian-2.118.0+nmu1/t/recipes/checks/files/hierarchy/standard/files-foo-in-bar/build-spec/debian/dirs 2024-08-14 12:45:47.000000000 +0200
@@ -1,7 +1,6 @@
etc/apt/preferences.d
etc/apt
etc/init
-bin/foo
mnt/foo
tmp/foo
usr/bin/foo
diff --minimal -Nru lintian-2.118.0/t/recipes/checks/files/hierarchy/standard/files-foo-in-bar/build-spec/debian/install lintian-2.118.0+nmu1/t/recipes/checks/files/hierarchy/standard/files-foo-in-bar/build-spec/debian/install
--- lintian-2.118.0/t/recipes/checks/files/hierarchy/standard/files-foo-in-bar/build-spec/debian/install 2021-09-04 16:23:12.000000000 +0200
+++ lintian-2.118.0+nmu1/t/recipes/checks/files/hierarchy/standard/files-foo-in-bar/build-spec/debian/install 2024-08-14 12:45:47.000000000 +0200
@@ -1,4 +1,4 @@
-bar bin/foo
+bar bin
bar emul
bar etc/apt/preferences.d
bar etc/apt/sources.list.d
@@ -8,11 +8,12 @@
bar etc/rc.boot
bar etc/rc.d
bar etc/udev/rules.d
-bar lib32
-bar lib64
-bar libx32
+bar usr/lib32
+bar usr/lib64
+bar usr/libx32
bar mnt/foo
bar run/foo
+bar sbin
bar srv/foo
bar tmp/foo
bar usr/bin/foo
diff --minimal -Nru lintian-2.118.0/t/recipes/checks/files/hierarchy/standard/files-foo-in-bar/eval/hints lintian-2.118.0+nmu1/t/recipes/checks/files/hierarchy/standard/files-foo-in-bar/eval/hints
--- lintian-2.118.0/t/recipes/checks/files/hierarchy/standard/files-foo-in-bar/eval/hints 2022-08-13 15:53:35.000000000 +0200
+++ lintian-2.118.0+nmu1/t/recipes/checks/files/hierarchy/standard/files-foo-in-bar/eval/hints 2024-08-14 12:45:47.000000000 +0200
@@ -1,5 +1,8 @@
files-foo-in-bar (binary): subdir-in-usr-bin [usr/bin/foo/]
-files-foo-in-bar (binary): subdir-in-bin [bin/foo/]
+files-foo-in-bar (binary): aliased-location [bin/bar]
+files-foo-in-bar (binary): aliased-location [bin/]
+files-foo-in-bar (binary): aliased-location [sbin/bar]
+files-foo-in-bar (binary): aliased-location [sbin/]
files-foo-in-bar (binary): non-standard-toplevel-dir [emul/]
files-foo-in-bar (binary): non-standard-toplevel-dir [build/]
files-foo-in-bar (binary): non-standard-dir-in-var [var/foo/]
@@ -7,9 +10,9 @@
files-foo-in-bar (binary): non-multi-arch-lib-dir [usr/libx32/]
files-foo-in-bar (binary): non-multi-arch-lib-dir [usr/lib64/]
files-foo-in-bar (binary): non-multi-arch-lib-dir [usr/lib32/]
-files-foo-in-bar (binary): non-multi-arch-lib-dir [libx32/]
-files-foo-in-bar (binary): non-multi-arch-lib-dir [lib64/]
-files-foo-in-bar (binary): non-multi-arch-lib-dir [lib32/]
+files-foo-in-bar (binary): aliased-location [libx32/]
+files-foo-in-bar (binary): aliased-location [lib64/]
+files-foo-in-bar (binary): aliased-location [lib32/]
files-foo-in-bar (binary): file-in-usr-local [usr/local/foo/bar]
files-foo-in-bar (binary): file-in-unusual-dir [var/run/foo/bar]
files-foo-in-bar (binary): file-in-unusual-dir [var/lock/foo/bar]
diff --minimal -Nru lintian-2.118.0/t/recipes/checks/files/hierarchy/standard/files-package-contains-usr-unmerged-pathnames/eval/hints lintian-2.118.0+nmu1/t/recipes/checks/files/hierarchy/standard/files-package-contains-usr-unmerged-pathnames/eval/hints
--- lintian-2.118.0/t/recipes/checks/files/hierarchy/standard/files-package-contains-usr-unmerged-pathnames/eval/hints 2022-08-13 15:53:35.000000000 +0200
+++ lintian-2.118.0+nmu1/t/recipes/checks/files/hierarchy/standard/files-package-contains-usr-unmerged-pathnames/eval/hints 2024-08-14 12:45:47.000000000 +0200
@@ -1 +1,3 @@
-files-package-contains-usr-unmerged-pathnames (binary): subdir-in-bin [bin/subdir/]
+files-package-contains-usr-unmerged-pathnames (binary): aliased-location [bin/subdir/file-outside-usr]
+files-package-contains-usr-unmerged-pathnames (binary): aliased-location [bin/subdir/]
+files-package-contains-usr-unmerged-pathnames (binary): aliased-location [bin/]
diff --minimal -Nru lintian-2.118.0/tags/a/aliased-location.tag lintian-2.118.0+nmu1/tags/a/aliased-location.tag
--- lintian-2.118.0/tags/a/aliased-location.tag 1970-01-01 01:00:00.000000000 +0100
+++ lintian-2.118.0+nmu1/tags/a/aliased-location.tag 2024-08-14 12:35:50.000000000 +0200
@@ -0,0 +1,17 @@
+Tag: aliased-location
+Severity: error
+Check: files/hierarchy/standard
+Explanation: The package installs into an aliased location.
+ Since Debian trixie, the <code>base-files</code> package sets up symbolic
+ links such as <code>/bin</code> pointing to <code>usr/bin</code>. Using the
+ former paths triggers undefined behaviour in the <code>dpkg</code> package
+ manager. It treats e.g. <code>/bin/sh</code> and <code>/usr/bin/sh</code> as
+ two distinct filesystem objects and does not notice that operations on either
+ affect the other. Therefore, packages must no longer install files into such
+ locations and must install them to the corresponding location below
+ <code>usr/</code> instead. References to such files do not have to be updated
+ as all packages may rely on their files being accessible via the aliased
+ locations at all times. The requirement is only imposed on the contents of
+ the <code>data.tar</code> of a binary package.
+See-Also:
+ debian-policy 10.1 #1074014
diff --minimal -Nru lintian-2.118.0/tags/s/subdir-in-bin.tag lintian-2.118.0+nmu1/tags/s/subdir-in-bin.tag
--- lintian-2.118.0/tags/s/subdir-in-bin.tag 2022-08-13 15:53:35.000000000 +0200
+++ lintian-2.118.0+nmu1/tags/s/subdir-in-bin.tag 1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +0,0 @@
-Tag: subdir-in-bin
-Severity: error
-Check: files/hierarchy/standard
-Explanation: The Filesystem Hierarchy Standard forbids the installation of new
- directories in <code>/bin</code>.
-See-Also: filesystem-hierarchy binessentialusercommandbinaries
Reply to: