overwriting an in-use executable

Christian Franke Christian.Franke@t-online.de
Sun Dec 13 21:33:00 GMT 2009


Andy Koppe wrote:
> 2009/12/13 Eric Blake:
>    
>>> Same when trying to 'rm' an in-use executable: Works on 1.7, fails with
>>> 'Permission denied' on 1.5. Cygwin 1.7 works like Linux here. I don't
>>> know whether POSIX requires this behavior.
>>>        
>> POSIX allows both behaviors, but the cygwin 1.7 behavior is more like
>> Linux and traditional unix semantics
>>      
> And very useful it is, but I was wondering why it works with 'mv' but not 'cp'?
>
>    

'cp' does not unlink() before overwriting an existing file, it tries to 
overwrite the data in place. This also fails on *nix, typically with 
"Text file busy".
'mv' only modifies the link between file name in directory and file 
data. The OS can keep the old data (inode) until the exe terminates.

Christian


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list