[Pbuilder-maint] Bug#392136: pbuilder: sysvinit's mounted lib/init/rw prevents cleanup

Roland Stigge stigge at antcom.de
Tue Oct 10 15:56:02 CEST 2006


Package: pbuilder
Version: 0.159
Severity: normal
Tags: patch

Hi,

new sysvinit leaves /lib/init/rw mounted. Since pbuilder doesn't know about
that, it doesn't unmount it and therefore can't successfully clean up the temp
dir. Although I already filed #391604 (debootstrap) and #391605 (cdebootstrap),
I think the attached patch is a good idea anyway since it prevents similar
problems in the future: If proc is used, /proc/mounts is scanned for mounted
directories under the build directory and unmounts them carefully.

bye,
  Roland

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-1-686
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_GB.UTF-8)

Versions of packages pbuilder depends on:
ii  cdebootstrap                  0.3.13     Bootstrap a Debian system
ii  coreutils                     5.97-5     The GNU core utilities
ii  debianutils                   2.17.3     Miscellaneous utilities specific t
ii  debootstrap                   0.3.3      Bootstrap a basic Debian system
ii  gcc                           4:4.1.1-11 The GNU C compiler
ii  wget                          1.10.2-2   retrieves files from the web

Versions of packages pbuilder recommends:
pn  cowdancer                     <none>     (no description available)
ii  devscripts                    2.9.21     Scripts to make the life of a Debi
ii  fakeroot                      1.5.10     Gives a fake root environment
ii  sudo                          1.6.8p12-4 Provide limited super user privile

-- no debconf information
-------------- next part --------------
--- pbuilder-modules.orig	2006-08-25 00:55:54.000000000 +0200
+++ pbuilder-modules	2006-10-10 15:45:04.000000000 +0200
@@ -114,30 +114,37 @@
 }
 
 function umountproc () {
-    if [ "$USEDEVPTS" = "yes" ]; then
-	umount_one "dev/pts"
-    fi
-    if [ "$USEDEVFS" = "yes" ]; then
-	umount_one "dev"
-    fi
-    if [ "$USEPROC" = "yes" ]; then
-	if [ -e $BUILDPLACE/proc/sys/fs/binfmt_misc/status ]; then
-	    umount_one "proc/sys/fs/binfmt_misc"
-	fi
-	umount_one "proc"
-    fi
-    if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
-	umount_one "selinux"
+    if [ "$USEPROC" = "yes" ] ; then
+        BUILDPLACE=`echo $BUILDPLACE | sed -e 's/\\/\\//\\//g'`
+        BUILDPLACE_escaped=`echo $BUILDPLACE | sed -e 's/\\//\\\\\\//g'`
+        for i in `cut -d" " -f2 /proc/mounts | \
+	          grep "^$BUILDPLACE" | \
+		  sed -e "s/^$BUILDPLACE_escaped\\///" | \
+		  grep -v '^proc$' | \
+		  sort -r` ; do
+	    umount_one $i
+	done
+        umount_one proc
+    else
+        if [ "$USEDEVPTS" = "yes" ]; then
+	    umount_one "dev/pts"
+        fi
+        if [ "$USEDEVFS" = "yes" ]; then
+	    umount_one "dev"
+        fi
+        if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
+	    umount_one "selinux"
+        fi
+        # push arguments on a stack to reverse direction.
+        local reversed
+        reversed=
+        for mnt in $BINDMOUNTS; do
+	    reversed="$mnt $reversed"
+        done
+        for mnt in $reversed; do
+	    umount_one "$mnt"
+        done
     fi
-    # push arguments on a stack to reverse direction.
-    local reversed
-    reversed=
-    for mnt in $BINDMOUNTS; do
-	reversed="$mnt $reversed"
-    done
-    for mnt in $reversed; do
-	umount_one "$mnt"
-    done
 }
 
 


More information about the Pbuilder-maint mailing list