diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-06-10 04:31:08 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-06-10 04:31:08 +0000 |
commit | c659f4044671e55f833d0b308b90b75274f0d805 (patch) | |
tree | 6b9d0e5012e36c706bc8ec15a638fcc011206e2d /lib/rubygems | |
parent | 020bd635acc3f2f2c53ea1e55f0e6005677367c5 (diff) | |
download | ruby-c659f4044671e55f833d0b308b90b75274f0d805.tar.gz |
Revert r28200.
It caused many failures on test-all and following is SEGV.
./ruby -e 'require %!#{"foo/" * 10000}foo!'
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems')
-rw-r--r-- | lib/rubygems/custom_require.rb | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/rubygems/custom_require.rb b/lib/rubygems/custom_require.rb index 36e3c78911..43b3136b60 100644 --- a/lib/rubygems/custom_require.rb +++ b/lib/rubygems/custom_require.rb @@ -4,6 +4,8 @@ # See LICENSE.txt for permissions. #++ +require 'rubygems' + module Kernel ## @@ -29,17 +31,10 @@ module Kernel gem_original_require path rescue LoadError => load_error if load_error.message.end_with?(path) and - begin - Gem.try_activate(path) - rescue Gem::LoadError => load_error - pat = "#{__FILE__}:#{__LINE__-2}:in " - bt = load_error.backtrace - num = bt.index {|e| e.start_with?(pat)} and bt.shift(num+2) - raise load_error - end - retry + spec = Gem.searcher.find(path) then + Gem.activate(spec.name, "= #{spec.version}") + gem_original_require path else - load_error.backtrace.shift(2) raise load_error end end @@ -47,5 +42,5 @@ module Kernel private :require private :gem_original_require -end unless Kernel.private_method_defined?(:gem_original_require) +end |