delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/03/28/18:22:55

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Sun, 28 Mar 2004 18:22:44 -0500 (EST)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Dan Kegel <dank AT kegel DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: Fun with #! (aka shebang) and filenames ending in .exe
In-Reply-To: <40672AF0.7030506@kegel.com>
Message-ID: <Pine.GSO.4.56.0403281820390.18236@slinky.cs.nyu.edu>
References: <62148 DOT 24 DOT 126 DOT 73 DOT 164 DOT 1080436603 DOT squirrel AT webmail4 DOT pair DOT com> <6 DOT 0 DOT 1 DOT 1 DOT 0 DOT 20040328135645 DOT 02865c58 AT 127 DOT 0 DOT 0 DOT 1> <40672AF0 DOT 7030506 AT kegel DOT com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.39

On Sun, 28 Mar 2004, Dan Kegel wrote:

> Larry Hall wrote:
> >>./foo.sh
> >>mv foo.sh foo.exe
> >>./foo.exe
> >>
> >>The first foo.sh works fine.  The second... well, it's entertaining.
> >>I have to kill the window, ^C is ignored.
> >
> > Well, ^C worked for me, though the terminal then would not respond to
> > any other input.  Maybe that's what you meant by "it's entertaining".
>
> I wouldn't expect the same results everywhere, but when
> I try it, the scroll bar goes away, and the screen is filled
> with falling snow.
>
> >>Now, I know one shouldn't do nasty tricks like that, but
> >>I ran into it very innocently.  I was trying to make a distcc
> >>masquerade directory on cygwin; my technique has been to
> >>create shell scripts with the same name as the real app
> >>that set a few variables and run a different app with the
> >>original commandline as arguments.  On cygwin, the original
> >>app was named something.exe, so using my usual technique, I
> >>created a shell script named something.exe, and kerblooie!
> >
> > Yes, this is a known issue.  It's the same old problem one would expect
> > to have on a system that relies on the filename to determine what it
> > should do with the file.  You'd see something similar with a .bat/.exe
> > file combination in Windows, unless I'm misinterpreting what you're
> > saying..
>
> Yes, except that since the exec is being done by Cygwin,
> you'd expect it to maybe pay attention to the #! line
> before trusting the .exe suffix.  But since #! isn't
> a Posix requirement, Cygwin is well within its rights to
> ignore it in this case.
> (cf. http://www.in-ulm.de/~mascheck/various/shebang/ )
>
> Anyway, my scripts now strip off .exe where appropriate
> (i.e. when naming wrapper scripts) and  add the missing
> .exe where appropriate (i.e. when trying to remove files),
> and that works fine.
> - Dan

'Ware of this issue:

<QUOTE from http://cygwin.com/cygwin-ug-net/using-specialnames.html#AEN846>
  If a shell script myprog and a program myprog.exe coexist in a
  directory, the program has precedence and is selected for execution of
  myprog.
</QUOTE>

HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

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