Bug#753944: diff for 0.215+nmu3 (was Re: Bug#753944: pbuilder: USENETWORK=no breaks package builds)

Thorsten Glaser tg at mirbsd.de
Fri Jul 11 18:03:10 UTC 2014


Salvatore Bonaccorso dixit:

>Have tested Niko's patch for one of the packages we had in the
>pkg-perl Group yesterday, liblwp-protocol-https-perl, and now builds
>correctly without the workaround.

Thanks. I’ve uploaded something based on Niko’s patch,
which also adds the dependency to ifconfig or ip, adds
support for using ifconfig instead of ip (both work),
and gets rid of the hack from +nmu2 which is no longer
needed with that.

Full debdiff, as usual, attached.

bye,
//mirabilos
-- 
21:49⎜<allamoox:#sendmail> I have a question guys,
     ⎜    Can I use my PC as SMTP server, I use Windows 7 .
     ⎜    Already googled and Installed IIS
     ⎜    but Still I can't send E-mail
-------------- next part --------------
diff -Nru pbuilder-0.215+nmu2/Makefile pbuilder-0.215+nmu3/Makefile
--- pbuilder-0.215+nmu2/Makefile	2013-03-26 10:19:42.000000000 +0100
+++ pbuilder-0.215+nmu3/Makefile	2014-07-11 19:58:44.000000000 +0200
@@ -58,6 +58,7 @@
 	pbuilder-satisfydepends-gdebi \
 	pbuilder-selftest \
 	pbuilder-uml-checkparams \
+	pbuilder-unshare-wrapper \
 	pbuilder-updatebuildenv \
 	pdebuild-checkparams \
 	pdebuild-internal \
diff -Nru pbuilder-0.215+nmu2/debian/changelog pbuilder-0.215+nmu3/debian/changelog
--- pbuilder-0.215+nmu2/debian/changelog	2014-07-04 13:21:10.000000000 +0200
+++ pbuilder-0.215+nmu3/debian/changelog	2014-07-11 19:57:49.000000000 +0200
@@ -1,3 +1,13 @@
+pbuilder (0.215+nmu3) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Enable the loopback device even when USE_NETWORK=no (Closes: #753944)
+    Patch based on one provided by Niko Tyni; thanks! This also allows
+    getting rid of the “env” hack and disabling network for pre-squeeze
+    chroot by setting the new namespace up before chrooting.
+
+ -- Thorsten Glaser <tg at mirbsd.de>  Fri, 11 Jul 2014 19:56:53 +0200
+
 pbuilder (0.215+nmu2) unstable; urgency=low
 
   * Fix missing space, thanks gregoa for spotting (Closes: #753690)
diff -Nru pbuilder-0.215+nmu2/debian/control pbuilder-0.215+nmu3/debian/control
--- pbuilder-0.215+nmu2/debian/control	2012-05-31 00:20:36.000000000 +0200
+++ pbuilder-0.215+nmu3/debian/control	2014-07-11 19:56:43.000000000 +0200
@@ -27,6 +27,7 @@
          wget,
          ${misc:Depends}
 Recommends: fakeroot,
+            net-tools | iproute2,
             sudo,
             devscripts
 Suggests: pbuilder-uml,
diff -Nru pbuilder-0.215+nmu2/pbuilder-buildpackage pbuilder-0.215+nmu3/pbuilder-buildpackage
--- pbuilder-0.215+nmu2/pbuilder-buildpackage	2014-07-04 13:20:38.000000000 +0200
+++ pbuilder-0.215+nmu3/pbuilder-buildpackage	2014-07-11 19:51:28.000000000 +0200
@@ -37,7 +37,7 @@
     # environment, so cowdancer shouldn't have to run, and fakeroot
     # should be running later, so it shouldn't matter.
     # LOGNAME: set this to shut up some tools.
-    SUTOUSER=" env LD_PRELOAD= LOGNAME=$BUILDUSERNAME /sbin/start-stop-daemon --start --pidfile /dev/null --chuid $BUILDUSERNAME --startas /bin/sh"
+    SUTOUSER="LD_PRELOAD= LOGNAME=$BUILDUSERNAME /sbin/start-stop-daemon --start --pidfile /dev/null --chuid $BUILDUSERNAME --startas /bin/sh"
     DEBBUILDOPTS="${DEBBUILDOPTS:+$DEBBUILDOPTS }-rfakeroot"
     EXTRAPACKAGES="${EXTRAPACKAGES} fakeroot"
     log "I: using fakeroot in build."
@@ -45,9 +45,10 @@
     # run the build in root
     BUILDUSERID=0
     BUILDUSERNAME=root
-    SUTOUSER=" env LOGNAME=$BUILDUSERNAME /bin/sh"
+    SUTOUSER="LOGNAME=$BUILDUSERNAME /bin/sh"
 fi
 
+UNSHARE=
 case $USENETWORK in
 yes)
 	if [ "$DEB_BUILD_ARCH_OS" = "linux" ]; then
@@ -56,9 +57,9 @@
 	fi
 	;;
 *)
-	if $CHROOTEXEC /usr/bin/unshare -n true; then
+	if /usr/bin/unshare -n -- /usr/lib/pbuilder/pbuilder-unshare-wrapper true; then
 		USENETWORK=no
-		SUTOUSER="/usr/bin/unshare -n -- $SUTOUSER"
+		UNSHARE="/usr/bin/unshare -n -- /usr/lib/pbuilder/pbuilder-unshare-wrapper"
 		log "I: pbuilder: network access will be disabled during build"
 	else
 		USENETWORK=yes
@@ -115,7 +116,7 @@
 createbuilduser
 CCACHE_ENV=
 setup_ccache
-SUTOUSER=${SUTOUSER/ env / env $CCACHE_ENV }
+SUTOUSER="$CCACHE_ENV $SUTOUSER"
 log "I: Installing the build-deps"
 executehooks "D"
 trap saveaptcache_umountproc_cleanbuildplace_trap exit sighup sigpipe
@@ -134,7 +135,7 @@
     log "E: pbuilder: Failed chowning to $BUILDUSERNAME:$BUILDUSERNAME"
     exit 1;
 fi
-if echo "( cd tmp/buildd; env PATH=\"$PATH\" /usr/bin/dpkg-source -x $(basename $PACKAGENAME) )" | $CHROOTEXEC $SUTOUSER ; then
+if echo "( cd tmp/buildd; env PATH=\"$PATH\" /usr/bin/dpkg-source -x $(basename $PACKAGENAME) )" | $UNSHARE $CHROOTEXEC env $SUTOUSER ; then
     : # success
 else
     log "E: pbuilder: Failed extracting the source"
@@ -154,7 +155,7 @@
     fi
     DPKG_COMMANDLINE="cd tmp/buildd/*/ && $DPKG_COMMANDLINE"
     log "I: Running $DPKG_COMMANDLINE"
-    echo "$DPKG_COMMANDLINE" | $CHROOTEXEC $SUTOUSER
+    echo "$DPKG_COMMANDLINE" | $UNSHARE $CHROOTEXEC env $SUTOUSER
 ) &
 BUILD_PID=$!
 if [ -n "${TIMEOUT_TIME}" ]; then
diff -Nru pbuilder-0.215+nmu2/pbuilder-unshare-wrapper pbuilder-0.215+nmu3/pbuilder-unshare-wrapper
--- pbuilder-0.215+nmu2/pbuilder-unshare-wrapper	1970-01-01 01:00:00.000000000 +0100
+++ pbuilder-0.215+nmu3/pbuilder-unshare-wrapper	2014-07-11 19:47:17.000000000 +0200
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+die() {
+	echo >&@ E: $2 returned error code $1
+	echo >&2 N: Could not set up the loopback interface.
+	exit 1
+}
+
+if test -x /sbin/ifconfig; then
+	/sbin/ifconfig lo up || die $? ifconfig
+elif test -x /sbin/ip; then
+	/sbin/ip link set lo up || die $? ip
+elif test -x /bin/ip; then
+	/bin/ip link set lo up || die $? ip
+else
+	echo >&2 E: Neither ifconfig nor ip found.
+	echo >&2 N: Could not set up the loopback interface.
+	exit 1
+fi
+
+exec "$@"


More information about the Pbuilder-maint mailing list