From: Hugh Sasse Date: 2010-01-29T03:02:18+09:00 Subject: [ruby-core:27940] Re: [Bug #2669] mkmf find_executable doesn't find .bat files On Fri, 29 Jan 2010, Luis Lavena wrote: > Issue #2669 has been updated by Luis Lavena. > > > Neither cygwin or MSYS (which is based in cygwin) likes batch files, that is one of the reasons is not marked as executable. > > A few patch levels ago for 1.8.6 and 1.9.1, Ruby didn't consider batch levels priority over extension-less executables. That was one of the issues when calling "rake" versus "rake.bat" > > I've commented about this back in 2008 here: > > http://blog.mmediasys.com/2008/04/24/contributions-speedup-and-less-quirks-for-us/ > > I believe mkmf needs to implement the same changes to match the behavior expressed and corrected in that ticket. > I only see: system('gem') vs system('gem.bat') Was annoying needed to patch every Rakefile or Ruby script that called gem or rake or any other tool installed via RubyGems. Turns out that wasn.t a Windows fault, but some faulty logic in the Windows version of Ruby when dealing with system() calls. Thanks to Nobuyoshi Nakada, 1.8 branch includes this fix, which solves a few things we discussed on rubyinstaller-devel mailing list to ease the need of tweaking the environment for MinGW. without any links to a ticket, but there is code in the thread linked to under "discussed" http://rubyforge.org/pipermail/rubyinstaller-devel/2008-April/000288.html and the last fully formed code seems to be here: http://rubyforge.org/pipermail/rubyinstaller-devel/2008-April/000298.html in which a batch file wraps an invocation of ruby, in a rather clever way. I'm probably being slow, but I don't see how that helps ruby find the wanted batch file, when it is looking for "things it can execute, notwithstanding that the permissions bit(s) for execution is(are) off". I'm not certain about the mechanisms in this next paragraph, but: I think the above fixes the problem that windows looks for files with certain extensions as executables, and not finding them if they don't have an extension. I think this #2669 wants ruby to find the .bat files as if they were executable, because that's what windows does. (Or seems to, in my experience. File associations.) So if we say "make" to windows, provided the paths are right, windows would find a make.bat, but if we say `make` to ruby, ruby would miss it because it has no execute bit. Or have I now confused myself as well as everyone else? Hugh