[Piuparts-devel] Bug#860433: [PATCH] Consider the /usr merge to be acceptable variation

Simon McVittie smcv at debian.org
Tue Jul 25 08:25:46 UTC 2017


Files that the dpkg database considers to be in /bin, /sbin, /lib*/**
are now allowed to be physically in /usr/bin, etc. due to symlinks in
the root directory, as created by usrmerge or debootstrap --merged-usr.

debootstrap is likely to switch to --merged-usr by default during the
buster release cycle. When that happens, piuparts should continue to
succeed in the resulting base tarballs.

Signed-off-by: Simon McVittie <smcv at debian.org>
Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=860433
---
 debian/changelog |  9 +++++++++
 piuparts.py      | 16 ++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 44fc51fa..9adf360f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+piuparts (0.78) UNRELEASED; urgency=medium
+
+  * Consider the /usr merge to be acceptable variation. Files that the
+    dpkg database considers to be in /bin, /sbin, /lib/**, /lib*/**
+    are now allowed to be physically in /usr/bin, etc. due to symlinks in
+    the root directory, as created by usrmerge or debootstrap --merged-usr.
+
+ -- Simon McVittie <smcv at debian.org>  Tue, 25 Jul 2017 09:17:39 +0100
+
 piuparts (0.77) unstable; urgency=medium
 
   [ Andreas Beckmann ]
diff --git a/piuparts.py b/piuparts.py
index a3bb89ff..f23c2775 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -1390,10 +1390,26 @@ class Chroot:
         file_owners = self.get_files_owned_by_packages()
         bad = []
         overwrites = False
+        usrmerge = set()
         for f in sorted(file_owners.keys()):
             dn, fn = os.path.split(f)
             dc = canonicalize_path(self.name, dn)
             if dn != dc:
+                # Allow the /usr merge to have taken place. For example, if
+                # f (the file recorded in the dpkg database) is /bin/cat,
+                # then dn is /bin, and it's OK for /bin to have become a
+                # symlink to /usr/bin. Similarly /sbin, /lib, /libQUAL
+                # (/lib32 etc.) or any subdirectory of /lib or /libQUAL
+                # can be /usr-merged.
+                if dc == '/usr' + dn and (dn in ('/bin', '/sbin') or
+                                          dn.startswith('/lib')):
+                    # Only report each directory once
+                    if dn not in usrmerge:
+                        usrmerge.add(dn)
+                        logging.info('%s converted to %s by /usr merge', dn, dc)
+
+                    continue
+
                 fc = os.path.join(dc, fn)
                 of = ", ".join(file_owners[f])
                 if fc in file_owners:
-- 
2.13.3



More information about the Piuparts-devel mailing list