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
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to