Directory existence prevents .exe execution

Luke Kendall luke.kendall@cisra.canon.com.au
Fri Apr 18 05:02:00 GMT 2008


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/



More information about the Cygwin mailing list