delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/04/18/00:08:40

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <48081EAB.10808@cisra.canon.com.au>
Date: Fri, 18 Apr 2008 14:08:11 +1000
From: Luke Kendall <luke DOT kendall AT cisra DOT canon DOT com DOT au>
User-Agent: Thunderbird 1.5.0.14 (Windows/20071210)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Directory existence prevents .exe execution
References: <D80722838B6A6B4BA3CA9D90BA70BBB302E0DFAF AT dhrseasvxb04 DOT messaging DOT danaherad DOT com> <20080416064211 DOT 40A7F84237 AT pessard DOT research DOT canon DOT com DOT au> <f60fe000804160213r5adcaff3pd860d22494a0a24a AT mail DOT gmail DOT com> <48080FC4 DOT 4090108 AT cisra DOT canon DOT com DOT au> <48081622 DOT 5030405 AT cygwin DOT com>
In-Reply-To: <48081622.5030405@cygwin.com>
X-IsSubscribed: yes
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

Larry Hall (Cygwin) wrote:
> On 04/17/2008, Luke Kendall wrote:
>> Mark J. Reed wrote:
>> > I still don't understand why you would put the ici dir in the same
>> > place as the ici script.  You can't do that on Unix, so why do it on
>> > Cygwin?
>> >
>> >   The creator did this because simply it seemed a convenient way to 
>> keep all the ici components together and easy to install and 
>> uninstall, and it also caused no problems for the Windows cmd.exe 
>> shell.  cmd doesn't try to execute directories as if they were 
>> programs.  ici has been around for about 25 years, so it wasn't 
>> designed with Cygwin in mind. 
>
> Everything didn't have to be named ici though.  But that's besides the
> point.
>
And that will probably have to be the solution.
> Cygwin doesn't attempt to execute directories.

What do you mean by Cygwin, in this case?  Bash?  Cygwin's 
implementation of exec()?
>   It uses stat() to find
> out what type of thing "foo" is.  Then it uses that information to
> decide how to handle "foo".
>
This is why I'm saying that something that handles the invocation of 
programs under Cygwin tries to execute directories:

$ /opt/bin/ici -help
bash: /opt/bin/ici: is a directory
$ whiches ici
/opt/bin/ici.exe
/opt/bin/ici.dll
/cygdrive/x/bin/ici.exe
/cygdrive/x/bin/ici.dll
$ ls -ld /opt/bin/Ici
drwxr-xr-x 1 luke Domain Users 0 Oct 17  2005 /opt/bin/Ici

It looks like something has stat()ed /opt/bin/ici and then decided it's 
been asked to execute that, and refusing (which makes a kind of sense), 
and bailing out with an error (*that* step seems wrong to me).

I assumed that the logic which invokes foo.exe when you type foo should 
not be trying to execute a directory called foo.  It's never right to 
try to execute a directory.

I'm suggesting that instead of trying to do that and reporting an error 
and failing, the code should just skip past that as obviously wrong and 
fall through to the rest of its logic, which would in fact do the right 
thing - even if the foo.exe was in some other directory entirely, later 
on the PATH!

Cheers,

luke

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