Project

General

Profile

Backport #9104 ยป rubygems.2.0.14.ruby.2.0.0.patch

drbrain (Eric Hodel), 11/13/2013 08:39 AM

View differences:

NEWS (working copy)
461 461
    XML declaration is used for XML document encoding.
462 462

  
463 463
* RubyGems
464
  * Updated to 2.0.13.
464
  * Updated to 2.0.14.
465 465

  
466
    See http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.0.13+%2F+2013-10-24
466
    See http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.0.14+%2F+2013-11-12
467 467
    for release notes.
468 468

  
469 469
  * Updated to 2.0.10.  This fixes CVE_2013-4363:
lib/rubygems/dependency_installer.rb (working copy)
278 278
      if gem_name =~ /\.gem$/ and File.file? gem_name then
279 279
        src = Gem::Source::SpecificFile.new(gem_name)
280 280
        set.add src.spec, src
281
      elsif gem_name =~ /\.gem$/ then
282
        Dir[gem_name].each do |name|
283
          begin
284
            src = Gem::Source::SpecificFile.new name
285
            set.add src.spec, src
286
          rescue Gem::Package::FormatError
287
          end
288
        end
281 289
      else
282 290
        local = Gem::Source::Local.new
283 291

  
lib/rubygems/specification.rb (working copy)
1027 1027
  # Removes +spec+ from the known specs.
1028 1028

  
1029 1029
  def self.remove_spec spec
1030
    # TODO: beat on the tests
1031
    raise "wtf: #{spec.full_name} not in #{all_names.inspect}" unless
1032
      _all.include? spec
1033 1030
    _all.delete spec
1034 1031
  end
1035 1032

  
lib/rubygems/ssl_certs/DigiCertHighAssuranceEVRootCA.pem (working copy)
1
-----BEGIN CERTIFICATE-----
2
MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs
3
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
4
d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j
5
ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDA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/IBcm2PN7EeqJSdnoDfzAIJ9VNep
22
+OkuE6N36B9K
23
-----END CERTIFICATE-----
lib/rubygems.rb (working copy)
8 8
require 'rbconfig'
9 9

  
10 10
module Gem
11
  VERSION = '2.0.13'
11
  VERSION = '2.0.14'
12 12
end
13 13

  
14 14
# Must be first since it unloads the prelude from 1.9.2
test/rubygems/test_gem_dependency_installer.rb (working copy)
854 854
    assert_equal Gem::Source.new(@gem_repo), s.source
855 855
  end
856 856

  
857
  def test_find_spec_by_name_and_version_wildcard
858
    util_gem 'a', 1
859
    FileUtils.mv 'gems/a-1.gem', @tempdir
860

  
861
    FileUtils.touch 'rdoc.gem'
862

  
863
    inst = Gem::DependencyInstaller.new
864

  
865
    available = inst.find_spec_by_name_and_version('*.gem')
866

  
867
    assert_equal %w[a-1], available.all_specs.map { |spec| spec.full_name }
868
  end
869

  
870
  def test_find_spec_by_name_and_version_wildcard_bad_gem
871
    FileUtils.touch 'rdoc.gem'
872

  
873
    inst = Gem::DependencyInstaller.new
874

  
875
    assert_raises Gem::Package::FormatError do
876
      inst.find_spec_by_name_and_version '*.gem'
877
    end
878
  end
879

  
857 880
  def test_find_spec_by_name_and_version_bad_gem
858 881
    FileUtils.touch 'rdoc.gem'
859 882

  
test/rubygems/test_gem_remote_fetcher.rb (working copy)
69 69

  
70 70
  PROXY_DATA = SERVER_DATA.gsub(/0.4.11/, '0.4.2')
71 71

  
72
  # don't let 1.8 and 1.9 autotest collide
73
  RUBY_VERSION =~ /(\d+)\.(\d+)\.(\d+)/
74
  # don't let parallel runners collide
75
  PROXY_PORT = process_based_port + 100 + $1.to_i * 100 + $2.to_i * 10 + $3.to_i
76
  SERVER_PORT = process_based_port + 200 + $1.to_i * 100 + $2.to_i * 10 + $3.to_i
77

  
78 72
  DIR = File.expand_path(File.dirname(__FILE__))
79 73

  
80 74
  def setup
......
87 81
    self.class.enable_yaml = true
88 82
    self.class.enable_zip = false
89 83

  
90
    base_server_uri = "http://localhost:#{SERVER_PORT}"
91
    @proxy_uri = "http://localhost:#{PROXY_PORT}"
84
    base_server_uri = "http://localhost:#{self.class.normal_server_port}"
85
    @proxy_uri = "http://localhost:#{self.class.proxy_server_port}"
92 86

  
93 87
    @server_uri = base_server_uri + "/yaml"
94 88
    @server_z_uri = base_server_uri + "/yaml.Z"
......
925 919
    attr_accessor :enable_zip, :enable_yaml
926 920

  
927 921
    def start_servers
928
      @normal_server ||= start_server(SERVER_PORT, SERVER_DATA)
929
      @proxy_server  ||= start_server(PROXY_PORT, PROXY_DATA)
922
      @normal_server ||= start_server(SERVER_DATA)
923
      @proxy_server  ||= start_server(PROXY_DATA)
930 924
      @enable_yaml = true
931 925
      @enable_zip = false
932 926
    end
933 927

  
928
    def normal_server_port
929
      @normal_server[:server].config[:Port]
930
    end
931

  
932
    def proxy_server_port
933
      @proxy_server[:server].config[:Port]
934
    end
935

  
934 936
    DIR = File.expand_path(File.dirname(__FILE__))
935 937
    DH_PARAM = OpenSSL::PKey::DH.new(128)
936 938

  
......
976 978

  
977 979
    private
978 980

  
979
    def start_server(port, data)
980
      Thread.new do
981
    def start_server(data)
982
      null_logger = NilLog.new
983
      s = WEBrick::HTTPServer.new(
984
        :Port            => 0,
985
        :DocumentRoot    => nil,
986
        :Logger          => null_logger,
987
        :AccessLog       => null_logger
988
        )
989
      s.mount_proc("/kill") { |req, res| s.shutdown }
990
      s.mount_proc("/yaml") { |req, res|
991
        if @enable_yaml
992
          res.body = data
993
          res['Content-Type'] = 'text/plain'
994
          res['content-length'] = data.size
995
        else
996
          res.status = "404"
997
          res.body = "<h1>NOT FOUND</h1>"
998
          res['Content-Type'] = 'text/html'
999
        end
1000
      }
1001
      s.mount_proc("/yaml.Z") { |req, res|
1002
        if @enable_zip
1003
          res.body = Zlib::Deflate.deflate(data)
1004
          res['Content-Type'] = 'text/plain'
1005
        else
1006
          res.status = "404"
1007
          res.body = "<h1>NOT FOUND</h1>"
1008
          res['Content-Type'] = 'text/html'
1009
        end
1010
      }
1011
      th = Thread.new do
981 1012
        begin
982
          null_logger = NilLog.new
983
          s = WEBrick::HTTPServer.new(
984
            :Port            => port,
985
            :DocumentRoot    => nil,
986
            :Logger          => null_logger,
987
            :AccessLog       => null_logger
988
            )
989
          s.mount_proc("/kill") { |req, res| s.shutdown }
990
          s.mount_proc("/yaml") { |req, res|
991
            if @enable_yaml
992
              res.body = data
993
              res['Content-Type'] = 'text/plain'
994
              res['content-length'] = data.size
995
            else
996
              res.status = "404"
997
              res.body = "<h1>NOT FOUND</h1>"
998
              res['Content-Type'] = 'text/html'
999
            end
1000
          }
1001
          s.mount_proc("/yaml.Z") { |req, res|
1002
            if @enable_zip
1003
              res.body = Zlib::Deflate.deflate(data)
1004
              res['Content-Type'] = 'text/plain'
1005
            else
1006
              res.status = "404"
1007
              res.body = "<h1>NOT FOUND</h1>"
1008
              res['Content-Type'] = 'text/html'
1009
            end
1010
          }
1011 1013
          s.start
1012 1014
        rescue Exception => ex
1013
          abort ex.message
1014
          puts "ERROR during server thread: #{ex.message}"
1015
          abort "ERROR during server thread: #{ex.message}"
1015 1016
        end
1016 1017
      end
1017
      sleep 0.2                 # Give the servers time to startup
1018
      th[:server] = s
1019
      th
1018 1020
    end
1019 1021

  
1020 1022
    def cert(filename)
test/rubygems/test_gem_specification.rb (working copy)
449 449
    assert_equal %w[a], Gem::Specification.outdated
450 450
  end
451 451

  
452
  def test_self_remove_spec
453
    assert_includes Gem::Specification.all_names, 'a-1'
454

  
455
    Gem::Specification.remove_spec @a1
456

  
457
    refute_includes Gem::Specification.all_names, 'a-1'
458
  end
459

  
460
  def test_self_remove_spec_removed
461
    open @a1.spec_file, 'w' do |io|
462
      io.write @a1.to_ruby
463
    end
464

  
465
    Gem::Specification.reset
466

  
467
    FileUtils.rm @a1.spec_file # bug #698
468

  
469
    Gem::Specification.remove_spec @a1
470

  
471
    refute_includes Gem::Specification.all_names, 'a-1'
472
  end
473

  
452 474
  DATA_PATH = File.expand_path "../data", __FILE__
453 475

  
454 476
  def test_handles_private_null_type