[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-cpio] Directory ownership lost in 2.9 and 2.10 when dir not emp
From: |
asc1000 |
Subject: |
Re: [Bug-cpio] Directory ownership lost in 2.9 and 2.10 when dir not empty |
Date: |
Fri, 30 Oct 2009 10:19:08 -0700 (PDT) |
Tim Kientzle wrote:
>
> That delayed strategy is necessary to handle cases where
> the parent directory is non-writable.
>
> Try your test again, but change the permissions on the "test"
> directory to read-only (chmod 555 test) before creating your
> test.cpio archive. I think you'll find that your patch
> makes cpio unable to restore the archive.
>
> I expect the real fix is to store ownership, atime,
> and mtime in the delay list so that apply_delayed_set_stat()
> can apply those as well. (Might rename the routine to
> apply_delayed_attributes() while you're making this change.)
>
> Cheers,
>
> Tim
>
>
Hi Tim,
Thanks for clarifying the purpose. I had suspected it was something along
those lines after reading some previous messages related to this problem.
It didn't originally occur to me because I always use the -depth option to
find, which puts the directory after its contents. Incidentally, the chmod
555 test did not prevent the patched cpio from restoring the tree because
the directory itself was processed after the contents.
I think I've come up with a solution that would handle all possible cases
(directory item precedes contents, directory item follows contents, and
directory item is not present at all). It would involve generating the
delayed list entries (including the properties as you suggest) from the
directory item in the archive stream rather than from the implicit creation
by make_path(). That way the restored directory will be created using umask
thus guaranteeing the contents will be writable. In the two cases where the
directory entry is in the archive stream the permissions will be restored to
original after all the files. In the case where there is no directory item
in the stream, they will remain as the default umask settings.
Perhaps that was the original intent! I'll post a patch when it is ready.
Thanks,
Amardeep
--
View this message in context:
http://old.nabble.com/Directory-ownership-lost-in-2.9-and-2.10-when-dir-not-empty-tp25843320p26133857.html
Sent from the Gnu - Cpio mailing list archive at Nabble.com.