Bug#542915: NMU patch

Steve M. Robbins steve at sumost.ca
Fri Dec 31 23:24:36 UTC 2010


Hi,

The patch for this NMU is as follows.

diff -u -r pbuilder-orig//debian/changelog pbuilder-0.199+nmu1//debian/changelog
--- pbuilder-orig//debian/changelog	2010-07-05 08:35:40.000000000 -0500
+++ pbuilder-0.199+nmu1//debian/changelog	2010-12-28 10:19:38.000000000 -0600
@@ -1,3 +1,13 @@
+pbuilder (0.199+nmu1) unstable; urgency=low
+
+  * Non-Maintainer Upload.
+  
+  * pbuilder-modules: don't clean $BUILDPLACE if another directory has
+    been bind-mounted under it; patch by Matthew Palmer.  (closes:
+    #542915)
+
+ -- Steve M. Robbins <smr at debian.org>  Tue, 28 Dec 2010 10:19:37 -0600
+
 pbuilder (0.199) unstable; urgency=low
 
   * add a more useful message for pbuilder-runhooks when hookdir cannot
diff -u -r pbuilder-orig//pbuilder-modules pbuilder-0.199+nmu1//pbuilder-modules
--- pbuilder-orig//pbuilder-modules	2010-06-19 22:55:28.000000000 -0500
+++ pbuilder-0.199+nmu1//pbuilder-modules	2010-12-27 22:29:34.000000000 -0600
@@ -319,9 +319,23 @@
 	log "W: Aborting with an error";
     fi
     if [ "${INTERNAL_BUILD_UML}" != "yes" ]; then
-	if [ -d "$BUILDPLACE" ]; then 
-	    log "I: cleaning the build env "
-	    clean_subdirectories "$BUILDPLACE"
+        if [ -d "$BUILDPLACE" ]; then
+            # A directory on the same partition as $BUILDPLACE, bind-mounted
+            # into $BUILDPLACE, will be cleaned out by clean_subdirectories
+            # (because -xdev doesn't know about bind mounts).  To avoid that
+            # potential disaster (and also to avoid ugly error messages from
+            # rmdir otherwise), we want to make sure that there is *nothing*
+            # mounted under the chroot before we do our bulldozer routine.
+            #
+            # The readlink -f is a simple way to canonicalize the path for
+            # $BUILDPLACE (no dirty double slashes for *us*), so it matches
+            # what will be in the output of mount.
+            if mount |grep -q -F " $(readlink -f $BUILDPLACE)/"; then
+                log "E: Something is still mounted under ${BUILDPLACE}; unmount and remove ${BUILDPLACE} manually"
+            else
+                log "I: cleaning the build env "
+                clean_subdirectories "$BUILDPLACE"
+            fi
 	fi;
     fi
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pbuilder-maint/attachments/20101231/99cc30e4/attachment.pgp>


More information about the Pbuilder-maint mailing list