Bug#474011: pbuilder ch{own,grp} on ${BUILDRESULT}/* inside UML

Vaclav Ovsik vaclav.ovsik at i.cz
Wed Apr 2 17:24:48 UTC 2008


Package: pbuilder
Version: 0.179
Severity: normal
Tags: patch

Hi,
I hope didn't overlook something inside pbuilder machine :)
I couldn't run pbuilder-user-mode-linux with configured
BUILDRESULT without modification of pbuilder-buildpackage.
The patch is attached.

pdebuild-user-mode-linux or pbuilder-user-mode-linux runs under ordinary
user (non root), so chown and chgrp on files outside UML (through
hostfs) results in permission denied.

A bits from my test case:

...

+++ UML_BUILDRESULT=/var/cache/pbuilder/sid/result

...

+ pbuilder-user-mode-linux build --uml-debugmode --buildresult /var/cache/pbuilder/sid/result ../hello_2.2-2.dsc

...

+ echo ' -> Mount build result dir outside UML [/var/cache/pbuilder/sid/result] as [/var/cache/pbuilder/pbuilder-umlresult]'
 -> Mount build result dir outside UML [/var/cache/pbuilder/sid/result] as [/var/cache/pbuilder/pbuilder-umlresult]

...

+ pbuilder build --distribution sid --buildresult /var/cache/pbuilder/pbuilder-umlresult --buildplace /var/cache/pbuilder/pbuilder-mnt --internal-build-uml --debug /home/zito/tmp/hello_2.2-2.dsc

...

+ BUILDRESULTUID=0
+ BUILDRESULTGID=0

...

+ '[' -f /var/cache/pbuilder/pbuilder-umlresult/hello_2.2-2_i386.sid.build ']'
+ chown 0:0 /var/cache/pbuilder/pbuilder-umlresult/hello_2.2-2_i386.sid.build
chown: changing ownership of `/var/cache/pbuilder/pbuilder-umlresult/hello_2.2-2_i386.sid.build': Operation not permitted
+ umountproc_cleanbuildplace_trap
+ umountproc_cleanbuildplace
+ '[' 1 -ne 0 ']'
+ echo ' -> Aborting with an error'
 -> Aborting with an error


Best Regards
-- 
Zito

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-6-xen-686
Locale: LANG=C, LC_CTYPE=cs_CZ.ISO-8859-2 (charmap=ISO-8859-2)

Versions of packages pbuilder depends on:
ii  cdebootstrap              0.4.4-~icz40+1 Bootstrap a Debian system
ii  coreutils                 5.97-5.3       The GNU core utilities
ii  debconf [debconf-2.0]     1.5.11etch1    Debian configuration management sy
ii  debianutils               2.17           Miscellaneous utilities specific t
ii  debootstrap               1.0.8          Bootstrap a basic Debian system
ii  gcc                       4:4.1.1-15     The GNU C compiler
ii  wget                      1.10.2-2       retrieves files from the web

Versions of packages pbuilder recommends:
ii  cowdancer               0.25             Copy-on-write directory tree utili
ii  devscripts              2.10.13-~icz40+1 Scripts to make the life of a Debi
ii  fakeroot                1.5.10           Gives a fake root environment
ii  sudo                    1.6.8p12-4       Provide limited super user privile

-- debconf information excluded
-------------- next part --------------
diff --git a/pbuilder-buildpackage b/pbuilder-buildpackage
index 18c781a..9afa00b 100755
--- a/pbuilder-buildpackage
+++ b/pbuilder-buildpackage
@@ -79,7 +79,7 @@ if [ -z "${PBUILDER_BUILD_LOGFILE}" ]; then
 fi
 
 # make logfile have the permissions, logfiles should already be created in all cases
-if [ -f "${PBUILDER_BUILD_LOGFILE}" ]; then
+if [ -f "${PBUILDER_BUILD_LOGFILE}" -a "${INTERNAL_BUILD_UML}" != "yes" ]; then
     chown "${BUILDRESULTUID}:${BUILDRESULTGID}" "${PBUILDER_BUILD_LOGFILE}"
     chgrp "${BUILDRESULTGID}" "${PBUILDER_BUILD_LOGFILE}"
 fi
@@ -157,8 +157,10 @@ umountproc
 
 
 if [ -d "${BUILDRESULT}" ]; then
-    chown "${BUILDRESULTUID}:${BUILDRESULTGID}" "${BUILDPLACE}"/tmp/buildd/*
-    chgrp "${BUILDRESULTGID}" "${BUILDPLACE}"/tmp/buildd/*
+    if [ "${INTERNAL_BUILD_UML}" != "yes" ]; then
+	chown "${BUILDRESULTUID}:${BUILDRESULTGID}" "${BUILDPLACE}"/tmp/buildd/*
+	chgrp "${BUILDRESULTGID}" "${BUILDPLACE}"/tmp/buildd/*
+    fi
     cp -p "${BUILDPLACE}"/tmp/buildd/* "${BUILDRESULT}" 2>/dev/null || true
 else
     echo "E: BUILDRESULT=[$BUILDRESULT] is not a directory." >&2


More information about the Pbuilder-maint mailing list