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.