X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Tue, 2 Jun 2009 15:46:21 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: [1.7] Surprising exe magic? Message-ID: <20090602134620.GD11803@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <4A19A4B9 DOT 8040700 AT gmail DOT com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A19A4B9.8040700@gmail.com> User-Agent: Mutt/1.5.19 (2009-02-20) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 On May 24 20:49, Dave Korn wrote: > admin AT ubik /tmp/exemagic > $ mv hello.x hello.test.x > > admin AT ubik /tmp/exemagic > $ ls -la > total 125 > drwxr-xr-x 1 DKAdmin None 0 May 24 20:36 . > drwxrwxrwt 1 DKAdmin None 90112 May 24 20:36 .. > -rwxr-xr-x 1 DKAdmin None 34326 May 24 20:36 hello.test.x.exe > -rw-r--r-- 1 DKAdmin None 121 May 24 20:36 hw.c > > I expect this is probably one of those things that there's no way to avoid > without breaking some far more common usage, perhaps? It's not that bad since > it still runs as expected, and you can rename it again explicitly to get the > name you really wanted: > > $ ./hello.test.x > Hello, .exe magic! > > admin AT ubik /tmp/exemagic > $ ls > hello.test.x.exe hw.c > > admin AT ubik /tmp/exemagic > $ mv hello.test.x.exe hello.test.x > > admin AT ubik /tmp/exemagic > $ ls > hello.test.x hw.c > > ... but I found it a bit surprising. Is it supposed to happen like this? I > had a look in the recent announcement posts, and in /usr/share/doc, and > couldn't find much explicit documentation about how exe magic works, but I > noted that mv doesn't support `--disable-exe-magic'. Have a look into the rename() routine. It's really tricky to get the .exe magic right when renaming a file. Every time I change it, another case crops up which doesn't quite work as expected. Take strip(1) for example. It strips a file by creating a temporary file without .exe suffix. It writes the stripped executable into it, then it renames the temp file back to the original file. Call `strip foo' on a file actually called foo.exe. Without .exe magic you end up with a file foo, which is kind of surprising. You expect that the resulting file is still called foo.exe, and that will work with the current implementation. However, other cases might not *quite* work as expected as you found out. P's are really, really welcome. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/