bug-cpio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-cpio] --extract-directory-mode=MODE


From: jidanni
Subject: [Bug-cpio] --extract-directory-mode=MODE
Date: Wed, 13 Feb 2008 01:57:40 +0800

I the cpio info page:

        % find . -print -depth | cpio -ov > tree.cpio

      This will take all the files in the current directory, the
   directories below and place them in the archive tree.cpio.  Again the
   `-o' creates an archive, and the `-v' option shows you the name of the
   files as they are archived.  *Note Copy-out mode::.  Using the `.' in
   the find statement will give you more flexibility when doing restores,
   as it will save file names with a relative path vice a hard wired,

Isn't "." the default if omitted?
Maybe you mean a (cd mydir; find -print ...)
example. Maybe not.

   absolute path.  The `-depth' option forces `find' to print of the
   entries in a directory before printing the directory itself.  This
   limits the effects of restrictive directory permissions by printing the
   directory entries in a directory before the directory name itself.

OK, but here add some advice, short of asking root to help, if some
clodsburger has sent you such a cpio archive with 555 mode dirs in it,
and didn't use -depth. Nope, with an archive like
dr-xr-xr-x life/tapes
dr-xr-xr-x life/tapes/samplers
-r--r--r-- life/tapes/samplers/rap2.txt
-r--r--r-- life/tapes/samplers/HousingLyrics
-r--r--r-- life/tapes/notes
You're gonna go nuts tying to extract it without root. Whatever you
mkdir and chmod will be set back and then block extracting.

Therefore cpio needs a
--extract-directory-mode=MODE (default: use current umask)
overrider!

      Extracting an archive requires a bit more thought because cpio will
   not create directories by default.  Another characteristic, is it will
   not overwrite existing files unless you tell it to.

But that doesn't mention the above "forgot -depth" case.

cpio (GNU cpio) 2.9




reply via email to

[Prev in Thread] Current Thread [Next in Thread]