
30 Jan
2005
30 Jan
'05
2:29 a.m.
"Lars Gullik Bjønnes" wrote:
The argument is not "shells do it that way". But "cp" does it that way. "cp" is not a shell it is a program specialized for copying files. Also that by not allowing overwrite of existing files it opens up for a race.
Not only a race. Delete/recreate loses all metainformation attached to the original file - inode, attributes, permissions, ACLs, alternate forks/streams; it is also possible that the program doesn't have permission to delete+recreate, but does have permission to overwrite this specific file. Of course one can use fopen and friends instead. ;-)