Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Mar 2007 21:20:31 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Tim Kientzle <tim@kientzle.com>
Cc:        src-committers@freebsd.org, cvs-src@freebsd.org, cvs-all@freebsd.org, Tim Kientzle <kientzle@freebsd.org>, Ruslan Ermilov <ru@freebsd.org>, Greg 'groggy' Lehey <grog@freebsd.org>
Subject:   Re: cvs commit: src/usr.sbin/pkg_install/lib url.c
Message-ID:  <20070308204754.Q3405@besplex.bde.org>
In-Reply-To: <45EFB9DA.3030704@kientzle.com>
References:  <200703061454.l26Esj7D043245@repoman.freebsd.org> <45EDA7E2.4040300@freebsd.org> <20070306204307.GD43608@rambler-co.ru> <20070306231228.GC68567@wantadilla.lemis.com> <45EE3BC4.8070309@freebsd.org> <20070307171432.B28541@delplex.bde.org> <20070307111745.GB14172@rambler-co.ru> <45EFB6C8.7050008@kientzle.com> <45EFB9DA.3030704@kientzle.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 7 Mar 2007, Tim Kientzle wrote:

> Tim Kientzle wrote:
>>>>> ... GNU tar(1) implied the
>>>>> -p option for root, but BSD tar(1) doesn't do that.
>
> Ah.  Here we are:
>
> contrib/tar/src/extract.c, revision 1.2 (07-Jun-2002) by sobomax
>
> +#ifndef __FreeBSD__
>   same_permissions_option += we_are_root;
>   same_owner_option += we_are_root;
> +#endif

1.2 was buggy.  It took 2 more commits (1.3 and 1.5) to recover the
old behaviour (old := old FreeBSD gnu tar and old gnu gnu tar too?)
After 1.5, the ownership handling doesn't depend on __FreeBSD__,
and same_permissions_option is incremented later after some umask
stuff that I don't quite understand.  Its increment doesn't depend
on we_are_root, but depends on same_permissions_option being set
previously (on the command line?).  So same_permissions_option is
always set in FreeBSD, but when it is set previously, the behaviour
actually matches its name (I think it gives umask 0 for everything),
but otherwise it is affected by the current umask in a way that I
don't quite understand.

The result for permissions seems to be only subtly different from
gnu gnu tar: without -p:
- as non-root, permissions are modified by the current umask, at least
   for regular files.  The late setting of same_permissions_option
   apparently gives normal umasking but not quite the same behaviour as
   -p since this variable is used for more than the umask stuff.
- as root, permissions are preserved.  I don't understand how this
   happens.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070308204754.Q3405>