mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
020bd635ac
commit
c659f40446
9 changed files with 113 additions and 144 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue