Mail Archives: djgpp-workers/2001/05/13/03:51:42
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 -