On Wed, 1 Jan 2003 10:10:35 +0200, Christoph Bugel <[EMAIL PROTECTED]> wrote:
> 
> interesting.. I didn't know that cp overwrites the existing inode.
> but indeed it does, it simply *truncates* the target file:
> 
> $ strace cp /bin/sleep mysleep  2>&1 | grep open.*sleep
> open("/bin/sleep", O_RDONLY|O_LARGEFILE) = 3
> open("mysleep", O_WRONLY|O_TRUNC|O_LARGEFILE) = 4
> 
> indeed, rm or mv will 'fix' the problem.

The point of using `cp' (or `cat >') is to keep the current (old) file
permissions. Using `rm + cp' or `mv' create the new file with your
default permissions or the moved file permissions.

Ehud.


-- 
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 mailto:[EMAIL PROTECTED]                  Better  Safe  Than  Sorry

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to