delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/05/24/15:37:49

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_21,J_CHICKENPOX_51,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4A19A4B9.8040700@gmail.com>
Date: Sun, 24 May 2009 20:49:13 +0100
From: Dave Korn <dave DOT korn DOT cygwin AT googlemail DOT com>
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: [1.7] Surprising exe magic?
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

  Assume, for the sake of argument, that hw.c contains some C code.

admin AT ubik /tmp/exemagic
$ gcc hw.c  -o hello.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.x
-rw-r--r-- 1 DKAdmin None   121 May 24 20:36 hw.c

admin AT ubik /tmp/exemagic
$ ./hello.x
Hello, .exe magic!

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'.

    cheers,
      DaveK


--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019