Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Sep 2011 12:59:08 -0400
From:      "David Magda" <dmagda@ee.ryerson.ca>
To:        =?iso-8859-1?Q?=22Olivier_Cochard-Labb=E9=22?= <olivier@cochard.me>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: cpio and directory owner preservation behaviour
Message-ID:  <d425d2a1c27308d89b01b3661e00559b.squirrel@webmail.ee.ryerson.ca>
In-Reply-To: <CA%2Bq%2BTcpCH5jU61q7cTR=nmQ06zRbCJNUvRPkbRCBk-VN6h02Lg@mail.gmail.com>
References:  <CA%2Bq%2BTcpCH5jU61q7cTR=nmQ06zRbCJNUvRPkbRCBk-VN6h02Lg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, September 22, 2011 10:54, Olivier Cochard-Labbé wrote:
[...]
> [root@R3]/#(cd /usr/local/etc; find . -name ripd.conf -type f | cpio
> -dumpv /tmp/)
>
> The file owner and permission for ripd.conf is keept:
> [root@R3]/#ls -alh /tmp/quagga/ripd.conf
> -rw-------  1 quagga  quagga   134B Sep 22 15:28 /tmp/quagga/ripd.conf
>
> But not the directory owner that is changed to root:wheel
> [root@R3]/#ls -alh /tmp | grep quagga
> drwxr-xr-x   2 root  wheel   512B Sep 22 16:41 quagga
>
> Is a cpio bug ?

No it is not a bug, because the find(1) command will only print 
"quagga/ripd.conf" to its output, and not "quagga/" as well. Since cpio(1)
only receives "quagga/ripd.conf", it will only put the information for
that item in the archive stream.

Try the following command:

   # (cd /usr/local/etc; find quagga | cpio -dumpv /tmp/)

instead. This should grab quagga/ itself, in addition to its contents in
the archive stream.

If you want to know which items (files, directories, other) that cpio(1)
grab information on just run the find(1) without piping its output
anywhere. If you don't see the item of interest on a line of its own,
cpio(1) will not grab its metadata.





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