bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cygwin: glob successfully for executables without ".exe" suffix


From: John E. Malmberg
Subject: Re: cygwin: glob successfully for executables without ".exe" suffix
Date: Sun, 09 Sep 2012 20:52:37 -0500
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1

On 9/9/2012 7:52 PM, Gregory M. Turner wrote:
The enclosed patch fixes (or tries to fix) the inability to glob for
executable files on cygwin without the ".exe" suffix.  This is required
because cygwin has a hack to behave as though foo and foo.exe both exist
as hardlinks to the same file, but unlike a real hard-link, readdir()
only provides the ".exe"-suffixed filename.

I posted this to the cygwin mailing list some days ago and nobody's
ridiculed or flamed me yet, which comes about as close to a ringing
endorsement as I would dare to hope for :)

In all seriousness, I doubt it's 100% correct.  There's a lot of goofy
corner cases I can imagine, i.e.: what happens if foo.exe is renamed to
foo outside of cygwin?  So far, I haven't gone out of my way to try and
test all of these possibilities -- the patch only deals with the typical
case where readdir() returns foo.exe and we are globbing for foo.

Assuming there's no memory allocation bugs or similar lurking in the
patch, at worst, it makes bash globbing less broken on cygwin, even if
it leaves more work to be done to make it fully correct.

I'd be happy to iterate if folks have some good ideas as to how to
improve the implementation.

Don't forget that the file test operators also need to be able to find the same binary files. Otherwise you can run into a situation where you can see the file with glob, but not see the file when you try to test to see if it exist or to stat it.

VMS should have the same issue as Cygwin, where executables are normally have a ".exe" on them. In testing on VMS though, trying to run executable "foo" is finding and running the "foo.exe" for Bash 4.2.37, and I have not put in any VMS specific code to make this happen.

Glob and readir() only report the foo.exe case, not the foo. I have not yet found anything that actually cares so far though.

On VMS the hack in the past has been to install a hard link to "foo" from foo.exe.

Regards,
-John
address@hidden
Personal Opinion Only





reply via email to

[Prev in Thread] Current Thread [Next in Thread]