[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#753801: pbuilder: Please consider patch to fix it on hurd-i386



Package: pbuilder
Version: 0.215+nmu2
Severity: normal
User: debian-hurd@lists.debian.org
Usertags: hurd

Dear Maintainer,

attached patch makes pbuilder working on hurd.

First and last hunks work around a hurd limitation: currently if
mountpoints (also device pathnames) contain superfluous "." and "/",
path is not canonicalized so user to properly umount needs to specify
mountpoint exactly as it was specified at mount time, with superfluous
"." and "/" if any.

See https://lists.gnu.org/archive/html/bug-hurd/2014-06/msg00018.html
thread.

Thanks for considering.
diff --git a/pbuilder-createbuildenv b/pbuilder-createbuildenv
index 8362b1c..1441d4c 100755
--- a/pbuilder-createbuildenv
+++ b/pbuilder-createbuildenv
@@ -73,7 +73,7 @@ if ! ( cd "$BUILDPLACE" && \
     --include=apt \
     "${DEBOOTSTRAPOPTS[@]}" \
     "$DISTRIBUTION" \
-    . \
+    "$BUILDPLACE" \
     "$MIRRORSITE" \
     $DEBOOTSTRAPSCRIPT ) ; then
     log "E: $DEBOOTSTRAP failed"
diff --git a/pbuilder-modules b/pbuilder-modules
index 055d611..f40f76d 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -153,6 +153,7 @@ function seems_truly_unmounted() {
 }
 
 function umount_one () {
+    DEB_BUILD_ARCH_OS=$(dpkg-architecture -qDEB_BUILD_ARCH_OS)
     if [ "${IGNORE_UMOUNT}" = "yes" ]; then
 	# support ignore umount option.
 	log "I: ignoring umount of $1 filesystem"
@@ -221,7 +222,7 @@ function umountproc () {
     if [ "$USEDEVFS" = "yes" ]; then
 	umount_one "dev"
     fi
-    if [ "$USERUNSHM" = "yes" ]; then
+    if [ "$USERUNSHM" = "yes" ] && [ "$DEB_BUILD_ARCH_OS" != "hurd" ]; then
 	umount_one "run/shm"
     fi
     if [ "$USEPROC" = "yes" ]; then
@@ -233,6 +234,17 @@ function umountproc () {
     if [ "$DEB_BUILD_ARCH_OS" = "kfreebsd" ]; then
         umount_one "sys"
     fi
+    if [ "$DEB_BUILD_ARCH_OS" = "hurd" ]; then
+        umount_one "servers"
+        umount_one "dev"
+
+        # Workaround to remove chroot on Hurd: once /dev firmlink is
+        # removed, chroot removal either gets stuck or fails by removing
+        # some devices.
+        for dev in $BUILDPLACE/dev/{netdde,tty*,pty*,fd,vcs}; do
+            settrans -fg $dev
+        done
+    fi
 }
 
 
@@ -244,11 +256,15 @@ function mountproc () {
     if [ "$USEPROC" = "yes" ]; then
 	log "I: mounting /proc filesystem"
 	mkdir -p $BUILDPLACE/proc
-	PROCFS="proc"
-	if [ "$DEB_BUILD_ARCH_OS" = "kfreebsd" ]; then
-	    PROCFS="linprocfs"
-	fi
-	mount -t $PROCFS /proc "$BUILDPLACE/proc"
+        case "$DEB_BUILD_ARCH_OS" in
+            kfreebsd)   PROCFS="linprocfs" ;;
+            hurd)       settrans -fg "$BUILDPLACE/proc"
+                        PROCFS="firmlink"
+            ;;
+            *)          PROCFS="proc" ;;
+        esac
+        mount -t $PROCFS /proc "$BUILDPLACE/proc" ||
+            [ $DEB_BUILD_ARCH_OS = hurd ] && true
 	ln -s ../proc/mounts $BUILDPLACE/etc/mtab 2> /dev/null || true
 	mounted[${#mounted[@]}]="$BUILDPLACE/proc"
     fi
@@ -279,6 +295,14 @@ function mountproc () {
 	mount -t selinuxfs /selinux "$BUILDPLACE/selinux"
 	mounted[${#mounted[@]}]="$BUILDPLACE/selinux"
     fi
+    if [ "$DEB_BUILD_ARCH_OS" = "hurd" ]; then
+        # /dev and /servers might have already been mounted at
+        # debootstrap chroot creation
+        mount -t firmlink /dev "$BUILDPLACE/dev" || true
+        mounted[${#mounted[@]}]="$BUILDPLACE/dev"
+        mount -t firmlink /servers "$BUILDPLACE/servers" || true
+        mounted[${#mounted[@]}]="$BUILDPLACE/servers"
+    fi
     MOUNTPARAMS="-obind"
     [ "$DEB_BUILD_ARCH_OS" = "kfreebsd" ] && MOUNTPARAMS="-t nullfs"
     for mnt in $BINDMOUNTS; do
diff --git a/pbuilderrc b/pbuilderrc
index d15eb53..9fdb14d 100644
--- a/pbuilderrc
+++ b/pbuilderrc
@@ -4,7 +4,7 @@
 BASETGZ=/var/cache/pbuilder/base.tgz
 #EXTRAPACKAGES=""
 #export DEBIAN_BUILDARCH=athlon
-BUILDPLACE=/var/cache/pbuilder/build/
+BUILDPLACE=/var/cache/pbuilder/build
 MIRRORSITE=http://cdn.debian.net/debian
 #OTHERMIRROR="deb http://www.home.com/updates/ ./"
 #export http_proxy=http://your-proxy:8080/

Reply to: