[Pbuilder-maint] pbuilder CVS update: pbuilder ChangeLog pbuilder-modules

pbuilder CVS Commit pbuilder-maint at lists.alioth.debian.org
Mon Oct 30 00:47:55 CET 2006


  User: lool    
  Date: 06/10/30 00:47:55

  Modified:    .        ChangeLog pbuilder-modules
  Log:
  * pbuilder-modules: add sanity checks during umount_one(); ignore
    umount errors of the type "umount: /foobar: not mounted" and "umount:
    /foobar: not found" as retries will be useless anyway, and these errors
    shouldn't cause data loss; fixes #391390.
  
  Revision  Changes    Path
  1.413     +8 -1      pbuilder/ChangeLog
  
  CVSWEB Options: -------------------
  
  CVSWeb: Annotate this file:            http://cvs.alioth.debian.org/cgi-bin/cvsweb.cgi/pbuilder/pbuilder/ChangeLog?annotate=1.413&cvsroot=
  
  CVSWeb: View this file:             http://cvs.alioth.debian.org/cgi-bin/cvsweb.cgi/pbuilder/pbuilder/ChangeLog?rev=1.413&content-type=text/x-cvsweb-markup&cvsroot=
  
  CVSWeb: Diff to previous version:   http://cvs.alioth.debian.org/cgi-bin/cvsweb.cgi/pbuilder/pbuilder/ChangeLog.diff?r1=1.413&r2=1.412&cvsroot=
  
  -----------------------------------
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvsroot/pbuilder/pbuilder/ChangeLog,v
  retrieving revision 1.412
  retrieving revision 1.413
  diff -u -r1.412 -r1.413
  --- ChangeLog	29 Oct 2006 02:16:49 -0000	1.412
  +++ ChangeLog	29 Oct 2006 23:47:55 -0000	1.413
  @@ -1,3 +1,10 @@
  +2006-10-29  Loic Minier <lool at dooz.org>
  +
  +	* pbuilder-modules: add sanity checks during umount_one(); ignore
  +	umount errors of the type "umount: /foobar: not mounted" and "umount:
  +	/foobar: not found" as retries will be useless anyway, and these
  +	errors shouldn't cause data loss; fixes #391390.
  +
   2006-10-29  Junichi Uekawa  <dancer at debian.org>
   
   	* Documentation/pbuilder-doc.xml: developer info is updated.
  
  
  
  1.100     +64 -8     pbuilder/pbuilder-modules
  
  CVSWEB Options: -------------------
  
  CVSWeb: Annotate this file:            http://cvs.alioth.debian.org/cgi-bin/cvsweb.cgi/pbuilder/pbuilder/pbuilder-modules?annotate=1.100&cvsroot=
  
  CVSWeb: View this file:             http://cvs.alioth.debian.org/cgi-bin/cvsweb.cgi/pbuilder/pbuilder/pbuilder-modules?rev=1.100&content-type=text/x-cvsweb-markup&cvsroot=
  
  CVSWeb: Diff to previous version:   http://cvs.alioth.debian.org/cgi-bin/cvsweb.cgi/pbuilder/pbuilder/pbuilder-modules.diff?r1=1.100&r2=1.99&cvsroot=
  
  -----------------------------------
  
  Index: pbuilder-modules
  ===================================================================
  RCS file: /cvsroot/pbuilder/pbuilder/pbuilder-modules,v
  retrieving revision 1.99
  retrieving revision 1.100
  diff -u -r1.99 -r1.100
  --- pbuilder-modules	24 Aug 2006 22:58:57 -0000	1.99
  +++ pbuilder-modules	29 Oct 2006 23:47:55 -0000	1.100
  @@ -86,6 +86,41 @@
       exit 1
   }
   
  +# test whether a directory is empty
  +# fails if "$*" exists but isn't a directory
  +# fails and outputs garbage if "$*" doesn't actually exist
  +is_empty_dir() {
  +  return "$(find "$*" -maxdepth 0 -type d -empty -printf 0 -o -printf 1)"
  +}
  +
  +# sanity checks to ensure mountpoint $1 is truly unmounted in $BUILDPLACE
  +# (fails relatively often to ensure we don't "rm -rf" a bind mount)
  +function seems_truly_unmounted() {
  +    local mountpoint
  +    mountpoint="$1"
  +    if ! [ -e "$BUILDPLACE/$mountpoint" ]; then
  +        echo "W: $mountpoint doesn't exist"
  +        return 1
  +    fi
  +    if ! [ -d "$BUILDPLACE/$mountpoint" ]; then
  +        echo "W: $mountpoint isn't a directory"
  +        return 1
  +    fi
  +    if [ -r "$BUILDPLACE/proc/mounts" ] && grep -q "^[^ ]* $mountpoint " "$BUILDPLACE/proc/mounts"; then
  +        echo "W: $mountpoint is mounted according to build place's /proc/mounts"
  +        return 1
  +    fi
  +    if [ -r "/proc/mounts" ] && grep -q "^[^ ]* $BUILDPLACE/$mountpoint " "/proc/mounts"; then
  +        echo "W: $mountpoint is mounted according to system's /proc/mounts"
  +        return 1
  +    fi
  +    if ! is_empty_dir "$BUILDPLACE/$mountpoint"; then
  +        echo "W: $mountpoint not empty"
  +        return 1
  +    fi
  +    return 0
  +}
  +
   function umount_one () {
       if [ "${IGNORE_UMOUNT}" = "yes" ]; then
   	# support ignore umount option.
  @@ -93,24 +128,45 @@
   	return
       fi
       echo " -> unmounting $1 filesystem"
  -    if ! umount "$BUILDPLACE/$1"; then
  -	    echo "W: Retrying to unmount $1"
  +    local UMOUNT_OUTPUT
  +    if ! UMOUNT_OUTPUT="$(LC_ALL=C umount "$BUILDPLACE/$1" 2>&1)"; then
  +        echo "W: Could not unmount $1: $UMOUNT_OUTPUT"
  +        local ignore_umount_error="no"
  +        case $UMOUNT_OUTPUT in
  +          "umount: "*": not found"|"umount:"*": not mounted")
  +            # run an additional set of sanity checks
  +            if seems_truly_unmounted "$1"; then
  +                ignore_umount_error="yes"
  +            else
  +                echo "W: Tried ignoring error in unmount, but sanity check failed: $1 might still be mounted"
  +            fi
  +            ;;
  +          *)
  +            ;;
  +        esac
  +        if [ "$ignore_umount_error" != "yes" ]; then
  +	    echo "W: Retrying to unmount $1 in 5s"
   	    sleep 5s
   	    while ! umount "$BUILDPLACE/$1"; do
   		sleep 5s
   		cat <<EOF
   
  -  Could not unmount $1, there might be some program 
  -  still using files in /proc (klogd?).
  -  Please check and kill the process manually so that I can unmount $1
  +  Could not unmount $1, some programs might
  +  still be using files in /proc (klogd?).
  +  Please check and kill these processes manually
  +  so that I can unmount $1.  Last umount error was:
  +$UMOUNT_OUTPUT
   
  -  This error is only happens with chroot; try using user-mode-linux to 
  -  avoid this message.
  +  This error only affects chroots; you may want to use
  +  user-mode-linux to avoid this message.
   
   EOF
   		chroot "$BUILDPLACE" bin/sh
   	    done
  -	fi
  +        else
  +            echo "W: Ignored error in unmount"
  +        fi
  +    fi
   }
   
   function umountproc () {
  
  
  



More information about the Pbuilder-maint mailing list