Bug#542915: pbuilder removes data from bind-mounted directories

Steve M. Robbins steve at sumost.ca
Tue Dec 28 04:41:36 UTC 2010


On Tue, Dec 28, 2010 at 09:38:30AM +1100, Matthew Palmer wrote:
> On Mon, Dec 27, 2010 at 05:04:02PM +0100, Julien Cristau wrote:
> > do you plan on NMUing pbuilder for this bug?
> 
> No, I don't consider it appropriate to NMU for an RC bug that I raised the
> severity on, withouth the acknowledgement of the maintainer that the
> severity is justified.  Someone else NMUing is a vote that the severity is
> justified.

The original submitter agreed with you on the severity.  That's good 
enough for me.  

I can do the upload if you like.  However, I'm confused by your
message of 2010-12-17, where you said "Patch 5 in a series:".  I'm
confused because I can see only one patch prior to this, and the later
patch seems to be a patch on the original patch.  Can you
confirm whether the following is the intended change or whether
there are 4 other patches I'm missing.  

Thanks,
-Steve

diff -u -r orig/pbuilder-0.199//pbuilder-modules pbuilder-0.199//pbuilder-modules
--- orig/pbuilder-0.199//pbuilder-modules       2010-06-19 22:55:28.000000000 -0500
+++ pbuilder-0.199//pbuilder-modules    2010-12-27 22:29:34.803419903 -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/20101227/cd0df3af/attachment.pgp>


More information about the Pbuilder-maint mailing list