Bug#344958: [Pbuilder-maint] Bug#344958: pbuilder: creates files
with weird owner/group
Junichi Uekawa
dancer at netfort.gr.jp
Fri Jan 6 12:19:20 UTC 2006
At Thu, 05 Jan 2006 19:44:54 +0200,
Lars Wirzenius wrote:
>
> to, 2006-01-05 kello 08:37 +0900, Junichi Uekawa kirjoitti:
> > > Building a package with "sudo pbuilder build --buildtarget foo" puts
> > > files in foo that are owned by user 1234, group 1234 (neither of which
> > > exists on the system). (Without --buildtarget they are put
> > > in /var/cache/pbuilder/result, but the same uid/gid). This seems
> > > strange.
> >
> > This is due to pbuilder now running inside fakeroot by default. The
> > default value '1234' (randomly picked) can be anything that isn't used
> > by other user, so pbuilder session will have a hard time interacting
> > with outside of chroot.
>
> I'm not sure I understand why the uid of the person who invoked pbuilder
> can't be used, or why pbuilder (which is run as root) can't chown the
> resulting files to the person who invoked it. (See $SUDO_UID and
> $SUDO_GID.)
>
>
The following is a patch:
--- pbuilder-buildpackage.~1.118.~ 2005-12-21 20:57:29.000000000 +0900
+++ pbuilder-buildpackage 2006-01-06 21:18:16.000000000 +0900
@@ -139,12 +139,10 @@
umountproc
if [ -d "${BUILDRESULT}" ]; then
- if [ -n "${BUILDRESULTUID}" ]; then
- chown "${BUILDRESULTUID}:${BUILDRESULTGID}" "${BUILDPLACE}"/tmp/buildd/*
- fi
- if [ -n "${BUILDRESULTGID}" ]; then
- chgrp "${BUILDRESULTGID}" "${BUILDPLACE}"/tmp/buildd/*
- fi
+ BUILDRESULTUID="${BUILDRESULTUID:-${SUDO_UID:-0}}"
+ chown "${BUILDRESULTUID}:${BUILDRESULTGID}" "${BUILDPLACE}"/tmp/buildd/*
+ BUILDRESULTGID="${BUILDRESULTGID:-${SUDO_GID:-0}}"
+ chgrp "${BUILDRESULTGID}" "${BUILDPLACE}"/tmp/buildd/*
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