ruby-changes:26803
From: drbrain <ko1@a...>
Date: Thu, 17 Jan 2013 09:40:35 +0900 (JST)
Subject: [ruby-changes:26803] drbrain:r38855 (trunk): * lib/rubygems/installer.rb: Untaint string when checking output
drbrain 2013-01-17 09:37:28 +0900 (Thu, 17 Jan 2013) New Revision: 38855 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38855 Log: * lib/rubygems/installer.rb: Untaint string when checking output for $SAFE=1 * lib/rubygems/specification.rb: Keep previously loaded specs as active. This prevents double loading when refreshing the gem list. * test/rubygems/test_gem.rb: Test for above * lib/rubygems.rb: Bump version to 2.0.0.rc.2 Modified files: trunk/ChangeLog trunk/lib/rubygems/installer.rb trunk/lib/rubygems/specification.rb trunk/lib/rubygems.rb trunk/test/rubygems/test_gem.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 38854) +++ ChangeLog (revision 38855) @@ -1,3 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Jan 17 09:30:21 2013 Eric Hodel <drbrain@s...> + + * lib/rubygems/installer.rb: Untaint string when checking output + for $SAFE=1 + + * lib/rubygems/specification.rb: Keep previously loaded specs as + active. This prevents double loading when refreshing the gem list. + * test/rubygems/test_gem.rb: Test for above + + * lib/rubygems.rb: Bump version to 2.0.0.rc.2 + Thu Jan 17 09:08:37 2013 Eric Hodel <drbrain@s...> * doc/syntax/control_expressions.rdoc: Added ? : ternary if Index: lib/rubygems/specification.rb =================================================================== --- lib/rubygems/specification.rb (revision 38854) +++ lib/rubygems/specification.rb (revision 38855) @@ -656,6 +656,12 @@ class Gem::Specification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L656 @@all = specs.values + # After a reset, make sure already loaded specs + # are still marked as activated. + specs = {} + Gem.loaded_specs.each_value{|s| specs[s] = true} + @@all.each{|s| s.activated = true if specs[s]} + _resort! end @@all Index: lib/rubygems/installer.rb =================================================================== --- lib/rubygems/installer.rb (revision 38854) +++ lib/rubygems/installer.rb (revision 38855) @@ -489,6 +489,7 @@ class Gem::Installer https://github.com/ruby/ruby/blob/trunk/lib/rubygems/installer.rb#L489 def ensure_loadable_spec ruby = spec.to_ruby_for_cache + ruby.untaint begin eval ruby Index: lib/rubygems.rb =================================================================== --- lib/rubygems.rb (revision 38854) +++ lib/rubygems.rb (revision 38855) @@ -98,7 +98,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L98 require 'rbconfig' module Gem - VERSION = '2.0.0.preview3.1' + VERSION = '2.0.0.rc.2' end # Must be first since it unloads the prelude from 1.9.2 Index: test/rubygems/test_gem.rb =================================================================== --- test/rubygems/test_gem.rb (revision 38854) +++ test/rubygems/test_gem.rb (revision 38855) @@ -959,6 +959,27 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L959 assert_includes Gem::Specification.all_names, @a1.full_name end + def test_self_refresh_keeps_loaded_specs_activated + util_make_gems + + a1_spec = @a1.spec_file + moved_path = File.join @tempdir, File.basename(a1_spec) + + FileUtils.mv a1_spec, moved_path + + Gem.refresh + + s = Gem::Specification.first + s.activate + + Gem.refresh + + Gem::Specification.each{|spec| assert spec.activated? if spec == s} + + Gem.loaded_specs.delete(s) + Gem.refresh + end + def test_self_ruby_escaping_spaces_in_path orig_ruby = Gem.ruby orig_bindir = Gem::ConfigMap[:bindir] -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/