From 8eb39185810a59ad8d3aa874ba8f6c9a7b0949ac Mon Sep 17 00:00:00 2001 From: drbrain Date: Wed, 25 Sep 2013 00:53:19 +0000 Subject: * lib/rubygems: Fix CVE-2013-4363. Miscellaneous minor improvements. * test/rubygems: Tests for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rubygems/commands/specification_command.rb | 2 +- lib/rubygems/commands/unpack_command.rb | 2 +- lib/rubygems/commands/update_command.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/rubygems/commands') diff --git a/lib/rubygems/commands/specification_command.rb b/lib/rubygems/commands/specification_command.rb index d96c8b8627..3bc02a9c14 100644 --- a/lib/rubygems/commands/specification_command.rb +++ b/lib/rubygems/commands/specification_command.rb @@ -127,7 +127,7 @@ Specific fields in the specification can be extracted in YAML format: end unless options[:all] then - specs = [specs.sort_by { |s| s.version }.last] + specs = [specs.max_by { |s| s.version }] end specs.each do |s| diff --git a/lib/rubygems/commands/unpack_command.rb b/lib/rubygems/commands/unpack_command.rb index e60e7d90fd..5a05ad0a81 100644 --- a/lib/rubygems/commands/unpack_command.rb +++ b/lib/rubygems/commands/unpack_command.rb @@ -134,7 +134,7 @@ command help for an example. specs = dependency.matching_specs - selected = specs.sort_by { |s| s.version }.last # HACK: hunt last down + selected = specs.max_by { |s| s.version } return Gem::RemoteFetcher.fetcher.download_to_cache(dependency) unless selected diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb index e53798db86..401698196d 100644 --- a/lib/rubygems/commands/update_command.rb +++ b/lib/rubygems/commands/update_command.rb @@ -134,7 +134,7 @@ command to remove old versions. g.name == spec.name and g.match_platform? end - highest_remote_gem = matching_gems.sort_by { |g,_| g.version }.last + highest_remote_gem = matching_gems.max_by { |g,_| g.version } highest_remote_gem ||= [Gem::NameTuple.null] -- cgit v1.2.3