cvs commit: src/usr.sbin/pkg_install/lib url.c

Ruslan Ermilov ru at FreeBSD.org
Wed Mar 7 11:21:10 UTC 2007


On Wed, Mar 07, 2007 at 05:15:08PM +1100, Bruce Evans wrote:
> On Tue, 6 Mar 2007, Tim Kientzle wrote:
> 
> >>>>>... GNU tar(1) implied the
> >>>>>-p option for root, but BSD tar(1) doesn't do that.
> >>>>
> >>>>Hmmm...  This might actually be considered a bsdtar bug.
> >>>>I'll look into it.
> >>>
> >>>That behavior of BSD tar(1) surprised me, to be honest.
> >
> >It's a trivial fix; there's already a check for whether
> >tar is being run by root.  If so, it sets _EXTRACT_OWNER
> >to restore the owner.  I just need to fill in the flags
> >associated with -p as well.
> >
> >One problem that I don't see documented in any GNU tar
> >docs I can find:  Is there a way to suppress this behavior
> >for root in GNU tar?
> 
> >From tar.info:
> 
> %%%
> `--no-same-owner'
>      Do not attempt to restore ownership when extracting.  This is the
>      default behavior for ordinary users, so this option has an effect
>      only for the superuser.
> %%%
> 
You probably wanted this instead:

: `--preserve-permissions'
: `--same-permissions'
: `-p'
:      When `tar' is extracting an archive, it normally subtracts the
:      users' umask from the permissions specified in the archive and
:      uses that number as the permissions to create the destination
:      file.  Specifying this option instructs `tar' that it should use
:      the permissions directly from the archive.  *Note Writing::.
: 
: `--no-same-permissions'
:      When extracting an archive, subtract the user's umask from files
:      from the permissions specified in the archive.  This is the
:      default behavior for ordinary users; this option has an effect
:      only for the superuser.

It doesn't say it explicitly that -p is the default option for root,
nowehre, but you can guess it from reading the last sentence.  ;)


Cheers,
-- 
Ruslan Ermilov
ru at FreeBSD.org
FreeBSD committer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20070307/c0b7d117/attachment.pgp


More information about the cvs-src mailing list