Control: severity -1 important

Hi,

First of all: ccache is no longer the default, so this bug should not be RC.

To reproduce the issue, add the following entries to /etc/pbuilderrc and
rebuild the base tarball (it's only easy to reproduce if ccache is in the base
tarball, and not installed afterwards).

CCACHEDIR="/var/cache/pbuilder/ccache"
EXTRAPACKAGES="ccache"


On Mon, Sep 02, 2013 at 10:48:15PM +0200, Yann Dirson wrote:
> Well, here is one that, although arguably kludgy, does works for me:
> simply forcing the dpkg-architecture run to write somewhere else.

The main issue is that the ccache dir is owned by the build user, but that it
is enabled for all commands, even those running as root. The real solution is
to make sure that ccache is only used when running as the build user. In that
case this issue goes away.

The attached patch should fix that by adding the CCACHE_DIR environment to the
SUTOUSER command. This means that all other commands (including the
dpkg-architecture which is called by pbuilder-satisfydepends) don't run
ccache.

Cheers,

Ivo

diff --git a/debian/changelog b/debian/changelog
index 295f934..ea52701 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+pbuilder (0.215+nmu1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * Only set CCACHE_DIR when running as build user. (closes: #666525)
+
+ -- Ivo De Decker <ivo.dedec...@ugent.be>  Sun, 06 Oct 2013 13:57:31 +0200
+
 pbuilder (0.215) unstable; urgency=low
 
   * Do not try to use /dev/shm if /run/shm is not present. (closes: #702811, #702102)
diff --git a/pbuilder-buildpackage b/pbuilder-buildpackage
index 45b1177..fbe2213 100755
--- a/pbuilder-buildpackage
+++ b/pbuilder-buildpackage
@@ -38,7 +38,7 @@ if [ -n "$BUILDUSERNAME" -a -n "$BUILDUSERID" ]; then
     # should be running later, so it shouldn't matter.
     # LOGNAME: set this to shut up some tools.
     # su -p : switch to user preserving env vars, we need most of them. 
-    SUTOUSER="env LD_PRELOAD= LOGNAME=$BUILDUSERNAME su -p $BUILDUSERNAME"
+    SUTOUSER="LD_PRELOAD= LOGNAME=$BUILDUSERNAME su -p $BUILDUSERNAME"
     DEBBUILDOPTS="${DEBBUILDOPTS:+$DEBBUILDOPTS }-rfakeroot"
     EXTRAPACKAGES="${EXTRAPACKAGES} fakeroot"
     log "I: using fakeroot in build."
@@ -92,7 +92,11 @@ fi
 
 recover_aptcache
 createbuilduser
+
+CCACHE_ENV=""
 setup_ccache
+SUTOUSER="env $CCACHE_ENV $SUTOUSER"
+
 log "I: Installing the build-deps"
 executehooks "D"
 trap saveaptcache_umountproc_cleanbuildplace_trap exit sighup sigpipe
diff --git a/pbuilder-buildpackage-funcs b/pbuilder-buildpackage-funcs
index 3083f03..d480177 100644
--- a/pbuilder-buildpackage-funcs
+++ b/pbuilder-buildpackage-funcs
@@ -109,6 +109,6 @@ function setup_ccache() {
         chown -R $BUILDUSERID:$BUILDUSERID "$BUILDPLACE/$CCACHEDIR"
         # Unfortunate difference between pbuilder-style and ccache-style config
         # env vars   :-/
-        export CCACHE_DIR="$CCACHEDIR"
+        CCACHE_ENV="CCACHE_DIR=$CCACHEDIR"
     fi
 }

Reply via email to