[comp.bugs.sys5] cpio unlinks directories

chrisb@risky.Convergent.COM (Chris Bertin) (04/16/91)

Cpio silently unlinks directories if you extract a file from an archive and
that file happens to be a directory on your file system: If you have a
directory '/x' and if you extract from an archive a file called '/x', the
entire '/x' tree is replaced with the '/x' file. The same is also true if
a file name matches any type of special file. Basically, cpio does an unlink()
on that name and doesn't care what it unlinks.

This is true on SVR3 and SVR4. It may also be true on SunOS and BSD, but I
couldn't try it as super-user on those systems (yes, you do have to be root
to unlink directories, so that problem only shows up if you run cpio as root).

It is unclear to me what cpio should do in cases when there is a file type
conflict between an archive and the file system, but I don't think cpio should
EVER unlink directories.

Chris

-- 
Chris Bertin		|   chrisb@risky.Convergent.COM
Unisys			|		or
(408) 435-3762		| ...!uunet!pyramid!ctnews!risky!chrisb