From owner-cvs-src@FreeBSD.ORG Wed Mar 7 04:12:53 2007 Return-Path: X-Original-To: cvs-src@freebsd.org Delivered-To: cvs-src@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8A45816A406; Wed, 7 Mar 2007 04:12:53 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: from kientzle.com (h-66-166-149-50.snvacaid.covad.net [66.166.149.50]) by mx1.freebsd.org (Postfix) with ESMTP id 5B0F113C4A5; Wed, 7 Mar 2007 04:12:53 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: from [10.0.0.222] (p54.kientzle.com [66.166.149.54]) by kientzle.com (8.12.9/8.12.9) with ESMTP id l274Cq24065869; Tue, 6 Mar 2007 20:12:53 -0800 (PST) (envelope-from kientzle@freebsd.org) Message-ID: <45EE3BC4.8070309@freebsd.org> Date: Tue, 06 Mar 2007 20:12:52 -0800 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20060422 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Greg 'groggy' Lehey" References: <200703061454.l26Esj7D043245@repoman.freebsd.org> <45EDA7E2.4040300@freebsd.org> <20070306204307.GD43608@rambler-co.ru> <20070306231228.GC68567@wantadilla.lemis.com> In-Reply-To: <20070306231228.GC68567@wantadilla.lemis.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: cvs-src@freebsd.org, src-committers@freebsd.org, Ruslan Ermilov , cvs-all@freebsd.org Subject: Re: cvs commit: src/usr.sbin/pkg_install/lib url.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Mar 2007 04:12:53 -0000 >>>> ... 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);