Le vendredi 11 juillet à 17h 14mn 32s (-0400), Daniel Kahn Gillmor a écrit :
> On 07/11/2014 08:43 AM, jhcha54008 wrote:
> > The following patch just change the owner of /var/cache/man/*
> > to man.
> >
> > Regards,
> > JH Chatenet
> >
> > diff -Naur a/usr/share/debirf/modules/z1_clean-root
> > b/usr/share/debirf/modules/z1_clean-root
> > --- a/usr/share/debirf/modules/z1_clean-root 2014-07-09
> > 22:28:14.000000000 +0200
> > +++ b/usr/share/debirf/modules/z1_clean-root 2014-07-10
> > 16:17:22.000000000 +0200
> > @@ -28,3 +28,11 @@
> >
> > # setup dynamically updated /etc/mtab
> > ln -sf /proc/mounts "$DEBIRF_ROOT/etc/mtab"
> > +
> > +# fix owner of /var/cache/man
> > +
> > +if [ -d "$DEBIRF_ROOT/var/cache/man" ]; then
> > + chown -R man:root "$DEBIRF_ROOT/var/cache/man"
> > +fi
> > +
> > +
>
> Why should this workaround be necessary? I am pretty strongly averse to
> any extra chown -R's so i'd like to figure out *why* it's happening
> instead of slapping on a band-aid. Maybe this is a bug in debootstrap's
> fakechroot variant or something?
>
> --dkg
>
debootstrap as root (and debirf make -r ...) creates /var/cache/man
subdirectories owned by man. The fakechroot variant (and debirf in
normal operation, without BUILD_ROOT=true) results in /var/cache/man
subdirectories owned by root.
As far as I understand, /var/cache/man proper is contained in the
archive of package man-db. Its owner is man and it is sgid root.
Subdirectories are created at postinst. They are updated after each
package installation (if there are man pages in it) : the postinst
script is called with argument 'triggered'.
The relevant part of the script :
perl -e '@pwd = getpwnam("man"); $( = $) = $pwd[3]; $< = $> = $pwd[2];
exec "/usr/bin/mandb", @ARGV' -- "$@" || true
Real and effective uid and real and effective gid are set to man,
and mandb is run with option -cq to create subdirectories, -pq to
update them. mandb creates files of uid 'man' and gid 'root' because
of the sgid bit of /var/cache/man. These files are created as GNU dbm
files through gdbm_open, which calls 'open'.
Now in a fakeroot environment, the files are owned by root. Is this related
to the fact that "fakeroot doesn't wrap open(), create(), etc."
(according to fakeroot(1)) ?
Let's try :
$ fakechroot fakeroot -s .fakeroot.state debootstrap --variant=fakechroot
jessie my_chroot
$ fakechroot fakeroot -i .fakeroot.state -s .fakeroot.state chroot my_chroot
# perl -e '@pwd = getpwnam("man"); $( = $) = $pwd[3]; $< = $> = $pwd[2];
exec "/bin/sh", @ARGV'
$ id
uid=6(man) gid=12(man) groups=12(man),1000
$ : > /tmp/example
$ ls -AlF /tmp
total 0
-rw-r----- 1 root root 0 Jul 15 09:17 example
(The owner is root, not man)
Regards,
JH Chatenet
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]