Date: Tue, 06 Mar 2007 20:12:52 -0800 From: Tim Kientzle <kientzle@freebsd.org> To: "Greg 'groggy' Lehey" <grog@freebsd.org> Cc: cvs-src@freebsd.org, src-committers@freebsd.org, Ruslan Ermilov <ru@freebsd.org>, cvs-all@freebsd.org Subject: Re: cvs commit: src/usr.sbin/pkg_install/lib url.c Message-ID: <45EE3BC4.8070309@freebsd.org> In-Reply-To: <20070306231228.GC68567@wantadilla.lemis.com> References: <200703061454.l26Esj7D043245@repoman.freebsd.org> <45EDA7E2.4040300@freebsd.org> <20070306204307.GD43608@rambler-co.ru> <20070306231228.GC68567@wantadilla.lemis.com>
next in thread | previous in thread | raw e-mail | index | archive | help
>>>> ... 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45EE3BC4.8070309>
