On Sun, Aug 05, 2001 at 08:16:11AM -0500, Carl Wilhelm Soderstrom wrote:
> > The basic algorithm for to copy in a _file_ (not a directory, pipe, et al) is:
> > 
> >    read $i     # actually, this is the cpio header data (inode info) for the
> >                # file, which is followed in a cpio archive by the file itself
> >    if [ -e $i ]
> >    then rm -f $i
> 	  ^^^^^
> 
> 	wait a second here! cpio is supposed to *copy* files, not *move*
> them. the man page repeatedly uses the word 'copy', and never mentions
> anything about 'delete'.

No,w I have to agree with you, Carl, that deletion really shouldn't be
part of cpio's fetaure set, but the example you quoted has nothing to
do with moving files.  It's deleting any preexisting file on the
destination filename; the source file is untouched.  Unless the source
and destination are the same file, in which case Bad Things Happen.

cp is smart enough to complain that "`foo' and `foo' are the same file"
if you try to copy something onto itself, so I can't see why cpio
should destroy the file in that case.

-- 
With the arrest of Dimitry Sklyarov it has become apparent that it is not
safe for non US software engineers to visit the United States. - Alan Cox
"To prevent unauthorized reading..."         - Adobe eBook reader license