[Top][All Lists]

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

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

From: Gregory M. Turner
Subject: cygwin: glob successfully for executables without ".exe" suffix
Date: Sun, 09 Sep 2012 17:52:04 -0700
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120824 Thunderbird/15.0

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.


Attachment: bash-4.2_p37-cygwin-exe-hack-globfix.patch
Description: Text document

reply via email to

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