[Rubygems-developers] RubyGems, building of extensions and paths

Luis Lavena luislavena at gmail.com
Tue Aug 19 19:09:37 EDT 2008

Hey Guys,

This just popped in rake-devel and also Ruby bugs reports in RubyForge:

[#21591] gem install hpricot failure 'C:/Program' not recognised on
win 64 system

Basically if you installed Ruby+RubyGems in a folder with spaces (the
default for 32bits applications in the 64bits version of XP/Vista), it
will generate a problem.

I've pinpointed the issue to how Gem.ruby is being used by the
ext_conf_builder (line 12) and rake_builder (line 13).

Ruby-core workaround this in the FileUtils code in revision 18701:


Looks like a dirty hack, but it adds the proper quotes around it:

irb(main):002:0> Gem.ruby
=> "C:/Program Files (x86)/Ruby18/bin/ruby.exe"

irb(main):003:0> Gem.ruby.sub(/.*\s.*/m, '"\&"')
=> "\"C:/Program Files (x86)/Ruby18/bin/ruby.exe\""

And on Linux (ubuntu):

irb(main):002:0> Gem.ruby
=> "/usr/bin/ruby"
irb(main):003:0> Gem.ruby.sub(/.*\s.*/m, '"\&"')
=> "/usr/bin/ruby"

I just tried the gem install hpricot scenario and overcome that issue,
but presented a new one related to make and path with spaces :-D
(That is not RubyGems fault, heheh)

Comments about this? Maybe I'm missing something on the cleverness of
the #sub functionality...

Thanks in advance for your time,
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 Rubygems-developers mailing list