[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-cpio] directory permissions and ownership lost in 2.9
From: |
Ladislav Michnovič |
Subject: |
Re: [Bug-cpio] directory permissions and ownership lost in 2.9 |
Date: |
Thu, 10 Apr 2008 12:28:51 +0200 |
Hello.
This problem was announced two months ago, see this email:
http://www.nabble.com/Re%3A-cpio-2.9%3A-sets-unexpected-%28wrong-%29-file-owner-UID-td15689526.html
There is also attached patch, but patched cpio pass only
two tests:
cpio-dir-perm-depth, cpio-dir-perm-no-depth
but this one still shows the bug:
cpio-dir-perm-passthrough.
Regards Ladislav.
On Thu, Apr 10, 2008 at 7:18 AM, Albert Y. C. Lai <address@hidden> wrote:
> Using cpio 2.9 and the traditional "find . -depth" (e.g., as in the cpio
> tutorial), directory permissions and ownerships are not set properly when
> the directory in question is non-empty.
>
> I have tried both cpio 2.9 distributed by Ubuntu 8.04 beta and the tarball
> from http://www.gnu.org/software/cpio/ .
>
>
> Example 1: Given the current directory has:
>
> .:
> total 0
> drwxrws--T 2 daemon backup 72 2008-04-10 00:38 d
>
> ./d:
> total 0
> -rw-r--r-- 1 daemon backup 0 2008-04-10 00:38 hello
>
> Now execute these as root:
>
> mkdir ../tgt
> find . -depth | cpio -pmd ../tgt
> ls -lR ../tgt
>
> ../tgt:
> total 0
> drwxr-xr-x 2 root root 72 2008-04-10 00:38 d
>
> ../tgt/d:
> total 0
> -rw-r--r-- 1 daemon backup 0 2008-04-10 00:38 hello
>
>
> Example 2: Given the current directory has:
>
> .:
> total 0
> drwxr-xr-x 2 trebla trebla 72 2008-04-10 00:39 d
>
> ./d:
> total 0
> -rw-r--r-- 1 trebla trebla 0 2008-04-10 00:39 hello
>
> Now execute these as user trebla:
>
> umask 077
> mkdir ../tgt
> find . -depth | cpio -pmd ../tgt
> ls -lR ../tgt
>
> ../tgt:
> total 0
> drwx------ 2 trebla trebla 72 2008-04-10 00:40 d
>
> ../tgt/d:
> total 0
> -rw-r--r-- 1 trebla trebla 0 2008-04-10 00:39 hello
>
>
> Similar behaviour if you go through "cpio -o | (cd ../tgt; cpio -idm)". In
> fact you can verify that the directory flags are stored into the archive
> file alright; the problem is during extraction.
>
> If you change "find . -depth" to "find .", omitting "-depth", the problem
> goes away.
>
> While umask and other process defaults are honoured when directories are
> not explicitly listed, which is great, when they are explicitly listed with
> flags (except in a delayed order) the flags are still ignored, which is not
> great IMO. Yes, I can omit "-depth" and be done, but the original behaviour
> has been relied upon for decades. It certainly caught me off-guard when I
> used cpio 2.9 (and the tradition find formula) to clone a whole system and
> then found out the clone broke.
>
>
>
> _______________________________________________
> Bug-cpio mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/bug-cpio
>