diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | lib/rubygems/stub_specification.rb | 25 |
2 files changed, 21 insertions, 10 deletions
@@ -1,3 +1,9 @@ +Wed Sep 9 18:16:14 2015 NAKAMURA Usaku <usa@ruby-lang.org> + + * lib/rubygems/stub_specification.rb (Gem::StubSpecification#data): + should not change the value of $. when `require`ing gems. + this fixed test failures introduced by r51813. + Wed Sep 9 16:55:45 2015 NAKAMURA Usaku <usa@ruby-lang.org> * ruby.c (usage, enable_option, disable_option, process_options): new diff --git a/lib/rubygems/stub_specification.rb b/lib/rubygems/stub_specification.rb index ed07e8011f..bb59077ca2 100644 --- a/lib/rubygems/stub_specification.rb +++ b/lib/rubygems/stub_specification.rb @@ -73,18 +73,23 @@ class Gem::StubSpecification < Gem::BasicSpecification unless @data @extensions = [] - open loaded_from, OPEN_MODE do |file| - begin - file.readline # discard encoding line - stubline = file.readline.chomp - if stubline.start_with?(PREFIX) then - @data = StubLine.new stubline - - @extensions = $'.split "\0" if - /\A#{PREFIX}/ =~ file.readline.chomp + begin + saved_lineno = $. + open loaded_from, OPEN_MODE do |file| + begin + file.readline # discard encoding line + stubline = file.readline.chomp + if stubline.start_with?(PREFIX) then + @data = StubLine.new stubline + + @extensions = $'.split "\0" if + /\A#{PREFIX}/ =~ file.readline.chomp + end + rescue EOFError end - rescue EOFError end + ensure + $. = saved_lineno end end |