[Rake-devel] Question about system call and multiple arguments.

Luis Lavena luislavena at gmail.com
Sun Nov 2 20:08:07 EST 2008

On Sun, Nov 2, 2008 at 9:29 PM, James M. Lawrence
<quixoticsycophant at gmail.com> wrote:
> On Sun, Nov 2, 2008 at 6:27 PM, Luis Lavena <luislavena at gmail.com> wrote:
>> Yes Lawrence, I remember our talk and that's why I published a follow
>> up to this message:
>> http://rubyforge.org/pipermail/rake-devel/2008-November/000620.html
> Sorry, I didn't see that separate thread.
>> So this approach will define RUBY (around line 900 in lib/rake.rb)
>> depending on the platforms, and append the full extension. That is
>> correct?
>>  RUBY = File.join(Config::CONFIG['bindir'],
>> Config::CONFIG['ruby_install_name'])
>>  RUBY << Config::CONFIG['EXEEXT'] unless RUBY_PLATFORM =~ /java/
>>  RUBY.sub!(/.*\s.*/m, '"\&"')
>> Thoughts?
> The last line looks like a bug; git blame says it was introduced on
> 9/21.  An executable containing quotes cannot be run with
> muti-argument system().  On all platforms (not just Windows), ruby()
> with multiple arguments will fail when there is whitespace in the
> bindir path.

Hmn, this actually was a problem when ruby resides in folder with
spaces, which usually happens when users install Ruby on Windows
inside "Program Files"

But again, you're right, this affect multiple arguments system() calls...

Similar fix was introduced to ruby source code too, by nobu (r18701):

lib/rake.rb (FileUtils#ruby): takes care of space containing path. [
ruby-Bugs-21591 ]

So again, a "fix" was introduced in ruby svn that actually is not
fixing thing partially, but introducing other issues in the long run.
Nice, eh?

> For jruby, Rake cannot use multi-argument system() for ruby().  I
> think our hand is forced on this one.  All arguments will have to be
> escaped and passed to single-argument system().  RUBY should not
> contain the bindir path, and the constant should probably be removed
> anyway.
> For non-jruby, your EXEEXT workaround seems doable, however I would
> make sure the EXEEXT is not present before appending it.  There's a
> remote possibility that some future CONFIG["ruby_install_name"] will
> contain the EXEEXT.

Argh, the joys of cross platform, again.

Jim: can you postpone 0.8.4 release for a bit until we figure out the
best option for this scenario?

Thank you.
Luis Lavena
Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams

More information about the Rake-devel mailing list