X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Message-ID: <4B255D7D.2030805@t-online.de> Date: Sun, 13 Dec 2009 22:32:45 +0100 From: Christian Franke User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.4) Gecko/20091017 SeaMonkey/2.0 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: overwriting an in-use executable References: <416096c60912130019s5188fdd9w2f561005ba2c8c69 AT mail DOT gmail DOT com> <4B24DB01 DOT 2040201 AT t-online DOT de> <4B24FF57 DOT 9050309 AT byu DOT net> <416096c60912131301j1d35faf4x2e0dd64b1fa2849 AT mail DOT gmail DOT com> In-Reply-To: <416096c60912131301j1d35faf4x2e0dd64b1fa2849@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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