[Rubygems-developers] [ rubygems-Bugs-28494 ] C: hard coded in rubygems.rb

James Tucker jftucker at gmail.com
Sun Aug 22 15:49:48 EDT 2010

On 22 Aug 2010, at 14:35, Luis Lavena wrote:

> On Sun, Aug 22, 2010 at 12:16 PM, James Tucker <jftucker at gmail.com> wrote:
>> I don't get why the code is not being taken as-is from the RubyGems repository. Sure we have backward compatibility stuff in there, but if I fix this in rubygems now, these modifications will have to be re-applied by core for the sake of a /really/ small optimisation?
> The issue actually is Ruby implementation of RubyGems, not RubyGems:
> http://github.com/rubygems/rubygems/blob/master/lib/rubygems.rb#L499

Yup, but the issue exists in both, it is only the pre-amble if RUBY_VERSION < '1.9' that has been removed.

> For this user scenario, it had defined as HOME just HOMEDRIVE, so
> File.expand_path "~" internally in Ruby 1.9.x raised an exception that
> failsafe to C:/

Yup, I see that it must be an exception, and that C:/ is wrong.

> A sane alternative will be take the root drive of Gem.ruby itself and not C:/

If that has a drive too...

> But again, the discrepancies between Ruby's RubyGems and standalone
> RubyGems are bad and not easy to fix follow and fix.


> I'm open to suggestions on this, but the patch is not as good I thought.

Not sure what you want suggestions for. Regarding the ruby <-> rubygems discrepancy I don't see a good reason that such things as this need changing in ruby, I mean, it might be "cleaner" but this kind of change is horrible for debugging.

As far as the code is concerned, see my patch, it should solve the issue in a usable manner. I chose to use the approach of just using '/', as this will address the root of the currently active drive (which must exist at least at process launch). Does this make sense?

I could also expand it out to try just HOMEDRIVE, then fallback to the root of Gem.ruby, then fall back to '/', but this seems long when it would almost be reasonable if all these things are missing, to just raise an exception.

More information about the Rubygems-developers mailing list