Bug #2978
closedTMP_RUBY_PREFIX sets incorrect values in gem prelude for ruby installed in $HOME
Description
=begin
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.
=end
Updated by nlugovoi (Nikolai Lugovoi) over 14 years ago
=begin
actually, the bug seems to be reintroduced (by merge conflict?) in r26895, while r26885 already had the fix:
Date: Fri Mar 12 04:56:34 2010 +0000
* tool/compile_prelude.rb: TMP_RUBY_PREFIX should replace rubylibprefix but not prefix.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@26885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
diff --git a/tool/compile_prelude.rb b/tool/compile_prelude.rb
index 93a6dd9..d13670d 100755
--- a/tool/compile_prelude.rb
+++ b/tool/compile_prelude.rb
@@ -48,7 +48,7 @@ class Prelude
key = $1
unless @mkconf
require './rbconfig'
-
@mkconf = RbConfig::MAKEFILE_CONFIG.merge('prefix'=>'#{TMP_RUBY_PREFIX}')
-
@mkconf = RbConfig::MAKEFILE_CONFIG.merge('rubylibprefix'=>'#{TMP_RUBY_PREFIX}') end if RbConfig::MAKEFILE_CONFIG.has_key? key val = RbConfig.expand("$(#{key})", @mkconf)
=end
Updated by nobu (Nobuyoshi Nakada) over 14 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r26970.
Nikolai, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end