Package: pbuilder
Version: 0.199
Severity: normal
Tags: patch
pbuilder's ccache support relies on being able to modify PATH when building
packages. Unfortunately, su's documented behaviour is to reset PATH to a
known safe setting (in login.defs), which breaks this (along with any other
attempts to manually set PATH in pbuilderrc).
Apparently (see irc-log.txt) su has had a bug in it that has failed to
mangle PATH, which has kept this bug hidden. However, the version of
login in squeeze definitely resets PATH.
The attached patch adjusts the way that commands are called in the su
session, preserving the environment and making ccache work.
-- System Information:
Debian Release: 5.0.3
APT prefers stable
APT policy: (500, 'stable'), (1, 'experimental'), (1, 'unstable'), (1,
'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.26-2-686 (SMP w/2 CPU cores)
Locale: LANG=en_AU, LC_CTYPE=en_AU (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash
Versions of packages pbuilder depends on:
ii cdebootstrap 0.5.4 Bootstrap a Debian system
ii coreutils6.10-6 The GNU core utilities
ii debconf [debconf-2.0]1.5.24 Debian configuration management sy
ii debianutils 2.30Miscellaneous utilities specific t
ii debootstrap 1.0.10lenny1Bootstrap a basic Debian system
ii wget 1.11.4-2+lenny2 retrieves files from the web
Versions of packages pbuilder recommends:
ii devscripts 2.10.35lenny7 scripts to make the life of a Debi
ii fakeroot 1.11 Gives a fake root environment
ii sudo 1.6.9p17-3Provide limited super user privile
Versions of packages pbuilder suggests:
ii cowdancer 0.47 Copy-on-write directory tree utili
pn gdebi-corenone (no description available)
pn pbuilder-uml none (no description available)
-- debconf information excluded
--- pbuilder-buildpackage.orig 2010-12-10 23:07:09.0 +1100
+++ pbuilder-buildpackage 2010-12-10 23:13:08.0 +1100
@@ -105,7 +105,7 @@
log E: pbuilder: Failed chowning to $BUILDUSERNAME:$BUILDUSERNAME
exit 1;
fi
-if echo ( cd tmp/buildd; /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) ) | $CHROOTEXEC $SUTOUSER ; then
: # success
else
log E: pbuilder: Failed extracting the source
@@ -116,7 +116,7 @@
executehooks A
-DPKG_COMMANDLINE=dpkg-buildpackage -us -uc ${DEBEMAIL:+\-e$DEBEMAIL\}
$DEBBUILDOPTS
+DPKG_COMMANDLINE=env PATH=$PATH dpkg-buildpackage -us -uc
${DEBEMAIL:+\-e$DEBEMAIL\} $DEBBUILDOPTS
(
: Build process
Dec 10 22:30:14 womblelool: I'd be interested to know how the path
modifications made for ccache in pbuilder-checkparams are ever supposed to
survive the call to su -p. I just don't see how it's possible, and without
it I can't see how your ccache support could possibly work.
Dec 10 22:46:43 lool womble: su -p preserves PATH in my testing here
Dec 10 22:47:05 lool womble: PATH=foo:$PATH su -p -c env | grep PATH
Dec 10 22:47:09 womblelool: What version of su are you running?
Dec 10 22:47:33 lool womble: 1:4.1.4.2-1ubuntu3
Dec 10 22:47:45 womblelool: That su command line gives me my path
back here
Dec 10 22:48:50 womblelool: login 1:4.1.4.2+svn3283-2 and
1:4.1.1-6+lenny1 both fail to preserve PATH, and the manpage says that's how
it's supposed to behave.
Dec 10 22:49:36 womble--preserve-environment Preserve the
current environment, except for: $PATH [...] $IFS
Dec 10 22:49:55 lool womble: the man page says it follows
/etc/login.defs; this has been fixed on 2010-08-28 apparently
Dec 10 22:50:13 lool womble: http://paste.debian.net/102039/
-8-
2010-08-28 Nicolas François nicolas.franc...@centraliens.net
* src/su.c: Fix handling of environment variables when
the environment is not changed. In particular, this makes su
behave as documented regarding PATH and IFS (i.e. they are reset)
when -p is provided.
-8-
Dec 10 22:51:42 lool I guess the PATH setting oculd be moved to
pbuilder-buildpackage