delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/04/17/05:00:23

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
Date: Thu, 17 Apr 2003 11:00:05 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Problem in executable file mechanism
Message-ID: <20030417090005.GU11137@cygbert.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20030416163529 DOT GQ11137 AT cygbert DOT vinschen DOT de> <Pine DOT GSO DOT 4 DOT 44 DOT 0304161257120 DOT 2150-100000 AT slinky DOT cs DOT nyu DOT edu>
Mime-Version: 1.0
In-Reply-To: <Pine.GSO.4.44.0304161257120.2150-100000@slinky.cs.nyu.edu>
User-Agent: Mutt/1.4.1i

On Wed, Apr 16, 2003 at 12:58:20PM -0400, Igor Pechtchanski wrote:
> On Wed, 16 Apr 2003, Corinna Vinschen wrote:
> 
> > On Wed, Apr 16, 2003 at 11:56:32AM -0400, Igor Pechtchanski wrote:
> > > Try "strace sh -c ls".
> > >       Igor
> >
> > Well... let's get serious.  What do you expect?  Think UNIX.  The
> > executable is 'ls'.  The directory is 'ls'.  This is only possible
> > on Windows because the executables have this .exe suffix.  On UNIX
> > this won't be a problem since there wouldn't be two files with the
> > same name in a directory.
> >
> > Corinna
> 
> Yes.  But since such a mechanism *was* introduced in Cygwin, shouldn't the
> executable take precedence, at least for an exec() call?  I can't think of
> a situation when anyone would want to exec() a directory...

That's not the point.  The point is that calls like stat() will find
"/usr/bin/ls" before finding "/usr/bin/ls.exe".  That's correct in
99% of the cases.  Just in the coincidental case of having a dir and
a binary of the same name in the same directory, returning "ls" before
"ls.exe" is incorrect.  But, honestly, how should stat() know that its
behaviour should suddenly be different than in the other 99% cases? 

The answer to the original posters problem is that simple:  Don't do this.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin AT cygwin DOT com
Red Hat, Inc.

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