... 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?

Tim Kientzle


Index: bsdtar.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/tar/bsdtar.c,v
retrieving revision 1.72
diff -u -r1.72 bsdtar.c
--- bsdtar.c    9 Jan 2007 08:12:17 -0000       1.72
+++ bsdtar.c    7 Mar 2007 04:12:14 -0000
@@ -233,8 +233,13 @@
        bsdtar->extract_flags = ARCHIVE_EXTRACT_TIME;

        /* Default for root user: preserve ownership on extract. */
-       if (bsdtar->user_uid == 0)
+       if (bsdtar->user_uid == 0) {
                bsdtar->extract_flags |= ARCHIVE_EXTRACT_OWNER;
+               bsdtar->extract_flags |= ARCHIVE_EXTRACT_PERM;
+               bsdtar->extract_flags |= ARCHIVE_EXTRACT_ACL;
+               bsdtar->extract_flags |= ARCHIVE_EXTRACT_XATTR;
+               bsdtar->extract_flags |= ARCHIVE_EXTRACT_FFLAGS;
+       }

        /* Rewrite traditional-style tar arguments, if used. */
        argv = rewrite_argv(bsdtar, &argc, argv, tar_opts);
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to