delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/05/13/03:51:42

Date: Sun, 13 May 2001 10:53:27 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: "Mark E." <snowball3 AT bigfoot DOT com>
cc: djgpp-workers AT delorie DOT com
Subject: Re: spawn* and LFN again
In-Reply-To: <3AFDD417.19934.410AD6@localhost>
Message-ID: <Pine.SUN.3.91.1010513104430.13251C-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sun, 13 May 2001, Mark E. wrote:

> > > Also, what if 'foo' is a shell script and 'foo.exe' already exists?
> > 
> > This was a problem Mark (I think) found and corrected lately.  It does
> > TRT now.
> 
> With Bash 2.05 compiled with libc cvs, the shell script 'foo' is executed. 
> However the way libc gets there troubles me. 
> 
> __spawnve does find 'foo.exe' and not 'foo'. But it restores the filename to 
> 'foo' before calling go32_exec. go32_exec finds out it has a shell script so 
> it calls script_exec. Now if it didn't wipe the '.exe' part, 'foo.exe' would 
> indeed be run.

This is funny: that "*rp = 0;" line which removes the .exe extension is a 
recent (post v2.03) addition, and it seems to be part of your, Mark, 
change which introduced the INTERP_FLAG_SKIP_SEARCH flag into the 
interpreters[] array.

See "cvs diff -up -r1.5 -r1.6 src/libc/dos/process/dosexec.c" for details.

I don't really understand why was that line added, and there's no comment 
in the code to help me out.  I tend to think that it was some editing 
glitch, or maybe a snafu with applying the patch.

Anyway, it definitely looks bogus (for starters, it breaks symlink 
support with .exe files ;-), and should IMHO be removed.

I will think about the `foo' vs `foo.exe' (and, more broadly, `foo.xyz' 
vs `foo.abc') issue and see what should be done in dosexec about them.
Suggestions are welcome.

- Raw text -


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