aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-17 00:37:28 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-17 00:37:28 +0000
commit219e1566876c2a6996b88728eb558691d5c77459 (patch)
tree4730b8dc51bd5d10d92b49a081bef77b1c0956e2
parent1be8ac57abca95de2525c9b56fb51e9c8a802660 (diff)
downloadruby-219e1566876c2a6996b88728eb558691d5c77459.tar.gz
* 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 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog11
-rw-r--r--lib/rubygems.rb2
-rw-r--r--lib/rubygems/installer.rb1
-rw-r--r--lib/rubygems/specification.rb6
-rw-r--r--test/rubygems/test_gem.rb21
5 files changed, 40 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index e1d2ba6067..c54b201a17 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Thu Jan 17 09:30:21 2013 Eric Hodel <drbrain@segment7.net>
+
+ * 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@segment7.net>
* doc/syntax/control_expressions.rdoc: Added ? : ternary if
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 3722e10780..dcfe74039c 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -98,7 +98,7 @@
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
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index 7f9975678f..780a88b04c 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -489,6 +489,7 @@ class Gem::Installer
def ensure_loadable_spec
ruby = spec.to_ruby_for_cache
+ ruby.untaint
begin
eval ruby
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 2c8b73a76b..841bfbf842 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -656,6 +656,12 @@ class Gem::Specification
@@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
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index 9efb056546..8fbae7f669 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -959,6 +959,27 @@ class TestGem < Gem::TestCase
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]