Bug #2978: TMP_RUBY_PREFIX sets incorrect values in gem prelude for ruby installed in $HOME
http://redmine.ruby-lang.org/issues/show/2978

Author: Nikolai Lugovoi
Status: Open, Priority: Normal
ruby -v: 1.9.2dev (2010-03-17 trunk 26961) [i686-linux]

For ruby (r26961), built and installed with configure --prefix=$HOME, I see odd values in Gem::ConfigMap that do not allow to load installed rubygems, see sample irb session:


irb(main):001:0> Gem::ConfigMap
=> {:EXEEXT=>"", :RUBY_SO_NAME=>"ruby", :arch=>"i686-linux",
:bindir=>"/home/nlugovoi/lib/ruby/bin",
:libdir=>"/home/nlugovoi/lib/ruby/lib", :ruby_install_name=>"ruby",
:ruby_version=>"1.9.1",
:rubylibprefix=>"/home/nlugovoi/lib/ruby/lib/ruby",
:sitedir=>"/home/nlugovoi/lib/ruby/lib/ruby/site_ruby",
:sitelibdir=>"/home/nlugovoi/lib/ruby/lib/ruby/site_ruby/1.9.1"}
irb(main):002:0> Gem.path
=> ["/home/nlugovoi/.gem/ruby/1.9.1",
"/home/nlugovoi/lib/ruby/lib/ruby/gems/1.9.1"]
irb(main):003:0> Gem.clear_paths
=> nil
irb(main):004:0> Gem::ConfigMap
=> {:EXEEXT=>"", :RUBY_SO_NAME=>"ruby", :arch=>"i686-linux",
:bindir=>"/home/nlugovoi/bin", :libdir=>"/home/nlugovoi/lib",
:ruby_install_name=>"ruby", :ruby_version=>"1.9.1",
:rubylibprefix=>"/home/nlugovoi/lib/ruby",
:sitedir=>"/home/nlugovoi/lib/ruby/site_ruby",
:sitelibdir=>"/home/nlugovoi/lib/ruby/site_ruby/1.9.1",
:datadir=>"/home/nlugovoi/share",
:vendordir=>"/home/nlugovoi/lib/ruby/vendor_ruby",
:vendorlibdir=>"/home/nlugovoi/lib/ruby/vendor_ruby/1.9.1"}
irb(main):005:0> Gem.path
=> ["/home/nlugovoi/.gem/ruby/1.9.1", "/home/nlugovoi/lib/ruby/gems/1.9.1"]

So, at the moment of loading, Gem::ConfigMap points to wrong
directories, :rubylibprefix=>"$HOME/lib/ruby/lib/ruby" instead of
:rubylibprefix=>"$HOME/lib/ruby", and fixes that only after
Gem.clear_paths

And that comes from from following code:

ruby.c:448: rb_const_set(rb_cObject, rb_intern_const("TMP_RUBY_PREFIX"), rb_obj_freeze(rb_str_new(RUBY_LIB_PREFIX, sizeof(RUBY_LIB_PREFIX)-1)));

Issue was introduced in changeset r26881 , and r26880 works without such problem.


----------------------------------------
http://redmine.ruby-lang.org