ruby-changes:50672
From: naruse <ko1@a...>
Date: Mon, 19 Mar 2018 17:27:12 +0900 (JST)
Subject: [ruby-changes:50672] naruse:r62837 (ruby_2_5): merge revision(s) 62244, 62246, 62301, 62302, 62303, 62422, 62436, 62452: [Backport #14481]
naruse 2018-03-19 17:27:04 +0900 (Mon, 19 Mar 2018) New Revision: 62837 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62837 Log: merge revision(s) 62244,62246,62301,62302,62303,62422,62436,62452: [Backport #14481] Merge RubyGems-2.7.5 from upstream. Please see its details: http://blog.rubygems.org/2018/02/06/2.7.5-released.html test_gem_util.rb: fix broken test * test/rubygems/test_gem_util.rb: no guarantee that tmpdir is always underneath the root directory at all. test_gem_commands_setup_command.rb: BUNDLER_VERS * test/rubygems/test_gem_commands_setup_command.rb: run bundled gem command, instead of installed one. no need to set bundled bundler unless Gem::USE_BUNDLER_FOR_GEMDEPS revert r62302 and force to define the version constant Merge RubyGems 2.7.6 from upstream. It fixed some security vulnerabilities. http://blog.rubygems.org/2018/02/15/2.7.6-released.html fix regexp literal warning. test/rubygems/test_gem_server.rb: eliminate duplicated character class warning. [Bug #14481] Remove unnecessary `[]`s Modified directories: branches/ruby_2_5/ Modified files: branches/ruby_2_5/lib/rubygems/commands/generate_index_command.rb branches/ruby_2_5/lib/rubygems/commands/owner_command.rb branches/ruby_2_5/lib/rubygems/commands/setup_command.rb branches/ruby_2_5/lib/rubygems/commands/unpack_command.rb branches/ruby_2_5/lib/rubygems/config_file.rb branches/ruby_2_5/lib/rubygems/ext/builder.rb branches/ruby_2_5/lib/rubygems/indexer.rb branches/ruby_2_5/lib/rubygems/installer.rb branches/ruby_2_5/lib/rubygems/package/file_source.rb branches/ruby_2_5/lib/rubygems/package/old.rb branches/ruby_2_5/lib/rubygems/package/tar_header.rb branches/ruby_2_5/lib/rubygems/package/tar_writer.rb branches/ruby_2_5/lib/rubygems/package.rb branches/ruby_2_5/lib/rubygems/request_set/lockfile.rb branches/ruby_2_5/lib/rubygems/security/trust_dir.rb branches/ruby_2_5/lib/rubygems/security.rb branches/ruby_2_5/lib/rubygems/server.rb branches/ruby_2_5/lib/rubygems/source.rb branches/ruby_2_5/lib/rubygems/specification.rb branches/ruby_2_5/lib/rubygems/stub_specification.rb branches/ruby_2_5/lib/rubygems/test_case.rb branches/ruby_2_5/lib/rubygems/test_utilities.rb branches/ruby_2_5/lib/rubygems/util.rb branches/ruby_2_5/lib/rubygems/validator.rb branches/ruby_2_5/lib/rubygems.rb branches/ruby_2_5/test/rubygems/test_gem.rb branches/ruby_2_5/test/rubygems/test_gem_commands_cleanup_command.rb branches/ruby_2_5/test/rubygems/test_gem_commands_install_command.rb branches/ruby_2_5/test/rubygems/test_gem_commands_owner_command.rb branches/ruby_2_5/test/rubygems/test_gem_commands_push_command.rb branches/ruby_2_5/test/rubygems/test_gem_commands_setup_command.rb branches/ruby_2_5/test/rubygems/test_gem_commands_uninstall_command.rb branches/ruby_2_5/test/rubygems/test_gem_dependency_installer.rb branches/ruby_2_5/test/rubygems/test_gem_doctor.rb branches/ruby_2_5/test/rubygems/test_gem_ext_builder.rb branches/ruby_2_5/test/rubygems/test_gem_gemcutter_utilities.rb branches/ruby_2_5/test/rubygems/test_gem_indexer.rb branches/ruby_2_5/test/rubygems/test_gem_install_update_options.rb branches/ruby_2_5/test/rubygems/test_gem_installer.rb branches/ruby_2_5/test/rubygems/test_gem_package.rb branches/ruby_2_5/test/rubygems/test_gem_package_old.rb branches/ruby_2_5/test/rubygems/test_gem_package_tar_header.rb branches/ruby_2_5/test/rubygems/test_gem_rdoc.rb branches/ruby_2_5/test/rubygems/test_gem_remote_fetcher.rb branches/ruby_2_5/test/rubygems/test_gem_request_set.rb branches/ruby_2_5/test/rubygems/test_gem_request_set_lockfile.rb branches/ruby_2_5/test/rubygems/test_gem_request_set_lockfile_parser.rb branches/ruby_2_5/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb branches/ruby_2_5/test/rubygems/test_gem_resolver_git_specification.rb branches/ruby_2_5/test/rubygems/test_gem_server.rb branches/ruby_2_5/test/rubygems/test_gem_source.rb branches/ruby_2_5/test/rubygems/test_gem_source_git.rb branches/ruby_2_5/test/rubygems/test_gem_specification.rb branches/ruby_2_5/test/rubygems/test_gem_stub_specification.rb branches/ruby_2_5/test/rubygems/test_gem_util.rb branches/ruby_2_5/test/rubygems/test_gem_version.rb branches/ruby_2_5/test/rubygems/test_require.rb branches/ruby_2_5/version.h Index: ruby_2_5/test/rubygems/test_gem_version.rb =================================================================== --- ruby_2_5/test/rubygems/test_gem_version.rb (revision 62836) +++ ruby_2_5/test/rubygems/test_gem_version.rb (revision 62837) @@ -2,6 +2,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_version.rb#L2 require 'rubygems/test_case' require "rubygems/version" +require "minitest/benchmark" + class TestGemVersion < Gem::TestCase class V < ::Gem::Version @@ -102,6 +104,15 @@ class TestGemVersion < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_version.rb#L104 end end + def bench_anchored_version_pattern + assert_performance_linear 0.5 do |count| + version_string = count.times.map {|i| "0" * i.succ }.join(".") << "." + version_string =~ Gem::Version::ANCHORED_VERSION_PATTERN + end + rescue RegexpError + skip "It fails to allocate the memory for regex pattern of Gem::Version::ANCHORED_VERSION_PATTERN" + end + def test_empty_version ["", " ", " "].each do |empty| assert_equal "0", Gem::Version.new(empty).version Index: ruby_2_5/test/rubygems/test_gem_source_git.rb =================================================================== --- ruby_2_5/test/rubygems/test_gem_source_git.rb (revision 62836) +++ ruby_2_5/test/rubygems/test_gem_source_git.rb (revision 62837) @@ -229,7 +229,7 @@ class TestGemSourceGit < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_source_git.rb#L229 Dir.chdir 'b' do b = Gem::Specification.new 'b', 1 - open 'b.gemspec', 'w' do |io| + File.open 'b.gemspec', 'w' do |io| io.write b.to_ruby end Index: ruby_2_5/test/rubygems/test_gem_request_set_lockfile.rb =================================================================== --- ruby_2_5/test/rubygems/test_gem_request_set_lockfile.rb (revision 62836) +++ ruby_2_5/test/rubygems/test_gem_request_set_lockfile.rb (revision 62837) @@ -31,7 +31,7 @@ class TestGemRequestSetLockfile < Gem::T https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_request_set_lockfile.rb#L31 def write_lockfile lockfile @lock_file = File.expand_path "#{@gem_deps_file}.lock" - open @lock_file, 'w' do |io| + File.open @lock_file, 'w' do |io| io.write lockfile end end @@ -387,7 +387,7 @@ DEPENDENCIES https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_request_set_lockfile.rb#L387 s.add_dependency 'c', '~> 1.0' end - open 'b.gemspec', 'w' do |io| + File.open 'b.gemspec', 'w' do |io| io.write b.to_ruby end @@ -400,7 +400,7 @@ DEPENDENCIES https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_request_set_lockfile.rb#L400 Dir.chdir 'c' do c = Gem::Specification.new 'c', 1 - open 'c.gemspec', 'w' do |io| + File.open 'c.gemspec', 'w' do |io| io.write c.to_ruby end @@ -455,7 +455,7 @@ DEPENDENCIES https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_request_set_lockfile.rb#L455 gem_deps_lock_file = "#{@gem_deps_file}.lock" - open gem_deps_lock_file, 'w' do |io| + File.open gem_deps_lock_file, 'w' do |io| io.write 'hello' end Index: ruby_2_5/test/rubygems/test_gem_resolver_git_specification.rb =================================================================== --- ruby_2_5/test/rubygems/test_gem_resolver_git_specification.rb (revision 62836) +++ ruby_2_5/test/rubygems/test_gem_resolver_git_specification.rb (revision 62837) @@ -70,7 +70,7 @@ class TestGemResolverGitSpecification < https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_resolver_git_specification.rb#L70 Dir.chdir 'git/a' do FileUtils.mkdir_p 'ext/lib' - open 'ext/extconf.rb', 'w' do |io| + File.open 'ext/extconf.rb', 'w' do |io| io.puts 'require "mkmf"' io.puts 'create_makefile "a"' end Index: ruby_2_5/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb =================================================================== --- ruby_2_5/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb (revision 62836) +++ ruby_2_5/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb (revision 62837) @@ -295,7 +295,7 @@ GEM https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb#L295 end def write_lockfile lockfile - open @lock_file, 'w' do |io| + File.open @lock_file, 'w' do |io| io.write lockfile end end Index: ruby_2_5/test/rubygems/test_gem_server.rb =================================================================== --- ruby_2_5/test/rubygems/test_gem_server.rb (revision 62836) +++ ruby_2_5/test/rubygems/test_gem_server.rb (revision 62837) @@ -100,7 +100,7 @@ class TestGemServer < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_server.rb#L100 specs_dir = File.join dir, 'specifications' FileUtils.mkdir_p specs_dir - open File.join(specs_dir, spec.spec_name), 'w' do |io| + File.open File.join(specs_dir, spec.spec_name), 'w' do |io| io.write spec.to_ruby end @@ -198,7 +198,7 @@ class TestGemServer < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_server.rb#L198 FileUtils.mkdir_p specs_dir - open File.join(specs_dir, spec.spec_name), 'w' do |io| + File.open File.join(specs_dir, spec.spec_name), 'w' do |io| io.write spec.to_ruby end @@ -339,7 +339,7 @@ class TestGemServer < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_server.rb#L339 specs_dir = File.join dir, 'specifications' FileUtils.mkdir_p specs_dir - open File.join(specs_dir, spec.spec_name), 'w' do |io| + File.open File.join(specs_dir, spec.spec_name), 'w' do |io| io.write spec.to_ruby end @@ -353,6 +353,171 @@ class TestGemServer < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_server.rb#L353 assert_match 'z 9', @res.body end + + def test_xss_homepage_fix_289313 + data = StringIO.new "GET / HTTP/1.0\r\n\r\n" + dir = "#{@gemhome}2" + + spec = util_spec 'xsshomepagegem', 1 + spec.homepage = "javascript:confirm(document.domain)" + + specs_dir = File.join dir, 'specifications' + FileUtils.mkdir_p specs_dir + + open File.join(specs_dir, spec.spec_name), 'w' do |io| + io.write spec.to_ruby + end + + server = Gem::Server.new dir, process_based_port, false + + @req.parse data + + server.root @req, @res + + assert_equal 200, @res.status + assert_match 'xsshomepagegem 1', @res.body + + # This verifies that the homepage for this spec is not displayed and is set to ".", because it's not a + # valid HTTP/HTTPS URL and could be unsafe in an HTML context. We would prefer to throw an exception here, + # but spec.homepage is currently free form and not currently required to be a URL, this behavior may be + # validated in future versions of Gem::Specification. + # + # There are two variant we're checking here, one where rdoc is not present, and one where rdoc is present in the same regex: + # + # Variant #1 - rdoc not installed + # + # <b>xsshomepagegem 1</b> + # + # + # <span title="rdoc not installed">[rdoc]</span> + # + # + # + # <a href="." title=".">[www]</a> + # + # Variant #2 - rdoc installed + # + # <b>xsshomepagegem 1</b> + # + # + # <a href="\/doc_root\/xsshomepagegem-1\/">\[rdoc\]<\/a> + # + # + # + # <a href="." title=".">[www]</a> + regex_match = /xsshomepagegem 1<\/b>\s+(<span title="rdoc not installed">\[rdoc\]<\/span>|<a href="\/doc_root\/xsshomepagegem-1\/">\[rdoc\]<\/a>)\s+<a href="\." title="\.">\[www\]<\/a>/ + assert_match regex_match, @res.body + end + + def test_invalid_homepage + data = StringIO.new "GET / HTTP/1.0\r\n\r\n" + dir = "#{@gemhome}2" + + spec = util_spec 'invalidhomepagegem', 1 + spec.homepage = "notavalidhomepageurl" + + specs_dir = File.join dir, 'specifications' + FileUtils.mkdir_p specs_dir + + open File.join(specs_dir, spec.spec_name), 'w' do |io| + io.write spec.to_ruby + end + + server = Gem::Server.new dir, process_based_port, false + + @req.parse data + + server.root @req, @res + + assert_equal 200, @res.status + assert_match 'invalidhomepagegem 1', @res.body + + # This verifies that the homepage for this spec is not displayed and is set to ".", because it's not a + # valid HTTP/HTTPS URL and could be unsafe in an HTML context. We would prefer to throw an exception here, + # but spec.homepage is currently free form and not currently required to be a URL, this behavior may be + # validated in future versions of Gem::Specification. + # + # There are two variant we're checking here, one where rdoc is not present, and one where rdoc is present in the same regex: + # + # Variant #1 - rdoc not installed + # + # <b>invalidhomepagegem 1</b> + # + # + # <span title="rdoc not installed">[rdoc]</span> + # + # + # + # <a href="." title=".">[www]</a> + # + # Variant #2 - rdoc installed + # + # <b>invalidhomepagegem 1</b> + # + # + # <a href="\/doc_root\/invalidhomepagegem-1\/">\[rdoc\]<\/a> + # + # + # + # <a href="." title=".">[www]</a> + regex_match = /invalidhomepagegem 1<\/b>\s+(<span title="rdoc not installed">\[rdoc\]<\/span>|<a href="\/doc_root\/invalidhomepagegem-1\/">\[rdoc\]<\/a>)\s+<a href="\." title="\.">\[www\]<\/a>/ + assert_match regex_match, @res.body + end + + def test_valid_homepage_http + data = StringIO.new "GET / HTTP/1.0\r\n\r\n" + dir = "#{@gemhome}2" + + spec = util_spec 'validhomepagegemhttp', 1 + spec.homepage = "http://rubygems.org" + + specs_dir = File.join dir, 'specifications' + FileUtils.mkdir_p specs_dir + + open File.join(specs_dir, spec.spec_name), 'w' do |io| + io.write spec.to_ruby + end + + server = Gem::Server.new dir, process_based_port, false + + @req.parse data + + server.root @req, @res + + assert_equal 200, @res.status + assert_match 'validhomepagegemhttp 1', @res.body + + regex_match = /validhomepagegemhttp 1<\/b>\s+(<span title="rdoc not installed">\[rdoc\]<\/span>|<a href="\/doc_root\/validhomepagegemhttp-1\/">\[rdoc\]<\/a>)\s+<a href="http:\/\/rubygems\.org" title="http:\/\/rubygems\.org">\[www\]<\/a>/ + assert_match regex_match, @res.body + end + + def test_valid_homepage_https + data = StringIO.new "GET / HTTP/1.0\r\n\r\n" + dir = "#{@gemhome}2" + + spec = util_spec 'validhomepagegemhttps', 1 + spec.homepage = "https://rubygems.org" + + specs_dir = File.join dir, 'specifications' + FileUtils.mkdir_p specs_dir + + open File.join(specs_dir, spec.spec_name), 'w' do |io| + io.write spec.to_ruby + end + + server = Gem::Server.new dir, process_based_port, false + + @req.parse data + + server.root @req, @res + + assert_equal 200, @res.status + assert_match 'validhomepagegemhttps 1', @res.body + + regex_match = /validhomepagegemhttps 1<\/b>\s+(<span title="rdoc not installed">\[rdoc\]<\/span>|<a href="\/doc_root\/validhomepagegemhttps-1\/">\[rdoc\]<\/a>)\s+<a href="https:\/\/rubygems\.org" title="https:\/\/rubygems\.org">\[www\]<\/a>/ + assert_match regex_match, @res.body + end + def test_specs data = StringIO.new "GET /specs.#{Gem.marshal_version} HTTP/1.0\r\n\r\n" @req.parse data @@ -378,7 +543,7 @@ class TestGemServer < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_server.rb#L543 specs_dir = File.join dir, 'specifications' FileUtils.mkdir_p specs_dir - open File.join(specs_dir, spec.spec_name), 'w' do |io| + File.open File.join(specs_dir, spec.spec_name), 'w' do |io| io.write spec.to_ruby end Index: ruby_2_5/test/rubygems/test_gem_ext_builder.rb =================================================================== --- ruby_2_5/test/rubygems/test_gem_ext_builder.rb (revision 62836) +++ ruby_2_5/test/rubygems/test_gem_ext_builder.rb (revision 62837) @@ -32,7 +32,7 @@ class TestGemExtBuilder < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_ext_builder.rb#L32 results = [] Dir.chdir @ext do - open 'Makefile', 'w' do |io| + File.open 'Makefile', 'w' do |io| io.puts <<-MAKEFILE all: \t@#{Gem.ruby} -e "puts %Q{all: \#{ENV['DESTDIR']}}" @@ -72,7 +72,7 @@ install: https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_ext_builder.rb#L72 results = [] Dir.chdir @ext do - open 'Makefile', 'w' do |io| + File.open 'Makefile', 'w' do |io| io.puts <<-MAKEFILE all: \t@#{Gem.ruby} -e "puts %Q{all: \#{ENV['DESTDIR']}}" @@ -107,7 +107,7 @@ install: https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_ext_builder.rb#L107 extconf_rb = File.join ext_dir, 'extconf.rb' - open extconf_rb, 'w' do |f| + File.open extconf_rb, 'w' do |f| f.write <<-'RUBY' require 'mkmf' @@ -168,7 +168,7 @@ install: https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_ext_builder.rb#L168 extconf_rb = File.join ext_dir, 'extconf.rb' - open extconf_rb, 'w' do |f| + File.open extconf_rb, 'w' do |f| f.write <<-'RUBY' require 'mkmf' @@ -290,7 +290,7 @@ install: https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_ext_builder.rb#L290 FileUtils.mkdir_p @spec.gem_dir - open File.join(@spec.gem_dir, "extconf.rb"), "w" do |f| + File.open File.join(@spec.gem_dir, "extconf.rb"), "w" do |f| f.write <<-'RUBY' puts "IN EXTCONF" extconf_args = File.join File.dirname(__FILE__), 'extconf_args' @@ -323,7 +323,7 @@ install: https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_ext_builder.rb#L323 build_info_file = File.join build_info_dir, "#{@spec.full_name}.info" - open build_info_file, 'w' do |io| + File.open build_info_file, 'w' do |io| io.puts '--with-foo-dir=/nonexistent' end Index: ruby_2_5/test/rubygems/test_gem_commands_uninstall_command.rb =================================================================== --- ruby_2_5/test/rubygems/test_gem_commands_uninstall_command.rb (revision 62836) +++ ruby_2_5/test/rubygems/test_gem_commands_uninstall_command.rb (revision 62837) @@ -92,7 +92,7 @@ class TestGemCommandsUninstallCommand < https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_commands_uninstall_command.rb#L92 # Evil hack to prevent false removal success FileUtils.rm_f @executable - open @executable, "wb+" do |f| f.puts "binary" end + File.open @executable, "wb+" do |f| f.puts "binary" end @cmd.options[:executables] = true @cmd.options[:args] = [@spec.name] @@ -204,7 +204,7 @@ class TestGemCommandsUninstallCommand < https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_commands_uninstall_command.rb#L204 end assert Gem::Specification.find_all_by_name('dep_x').length > 0 - assert Gem::Specification.find_all_by_name('x').length == 0 + assert Gem::Specification.find_all_by_name('x').length.zero? end def test_execute_all Index: ruby_2_5/test/rubygems/test_gem_dependency_installer.rb =================================================================== --- ruby_2_5/test/rubygems/test_gem_dependency_installer.rb (revision 62836) +++ ruby_2_5/test/rubygems/test_gem_dependency_installer.rb (revision 62837) @@ -424,7 +424,7 @@ class TestGemDependencyInstaller < Gem:: https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_dependency_installer.rb#L424 extconf_rb = File.join @gemhome, 'gems', 'e-1', 'extconf.rb' FileUtils.mkdir_p File.dirname extconf_rb - open extconf_rb, 'w' do |io| + File.open extconf_rb, 'w' do |io| io.write <<-EXTCONF_RB require 'mkmf' create_makefile 'e' Index: ruby_2_5/test/rubygems/test_gem_commands_push_command.rb =================================================================== --- ruby_2_5/test/rubygems/test_gem_commands_push_command.rb (revision 62836) +++ ruby_2_5/test/rubygems/test_gem_commands_push_command.rb (revision 62837) @@ -132,7 +132,7 @@ class TestGemCommandsPushCommand < Gem:: https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_commands_push_command.rb#L132 } FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path - open Gem.configuration.credentials_path, 'w' do |f| + File.open Gem.configuration.credentials_path, 'w' do |f| f.write keys.to_yaml end Gem.configuration.load_api_keys @@ -166,7 +166,7 @@ class TestGemCommandsPushCommand < Gem:: https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_commands_push_command.rb#L166 } FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path - open Gem.configuration.credentials_path, 'w' do |f| + File.open Gem.configuration.credentials_path, 'w' do |f| f.write keys.to_yaml end Gem.configuration.load_api_keys @@ -193,7 +193,7 @@ class TestGemCommandsPushCommand < Gem:: https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_commands_push_command.rb#L193 } FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path - open Gem.configuration.credentials_path, 'w' do |f| + File.open Gem.configuration.credentials_path, 'w' do |f| f.write keys.to_yaml end Gem.configuration.load_api_keys @@ -235,7 +235,7 @@ class TestGemCommandsPushCommand < Gem:: https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_commands_push_command.rb#L235 } FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path - open Gem.configuration.credentials_path, 'w' do |f| + File.open Gem.configuration.credentials_path, 'w' do |f| f.write keys.to_yaml end Gem.configuration.load_api_keys @@ -266,7 +266,7 @@ class TestGemCommandsPushCommand < Gem:: https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_commands_push_command.rb#L266 } FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path - open Gem.configuration.credentials_path, 'w' do |f| + File.open Gem.configuration.credentials_path, 'w' do |f| f.write keys.to_yaml end Gem.configuration.load_api_keys Index: ruby_2_5/test/rubygems/test_gem_commands_cleanup_command.rb =================================================================== --- ruby_2_5/test/rubygems/test_gem_commands_cleanup_command.rb (revision 62836) +++ ruby_2_5/test/rubygems/test_gem_commands_cleanup_command.rb (revision 62837) @@ -158,7 +158,7 @@ class TestGemCommandsCleanupCommand < Ge https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_commands_cleanup_command.rb#L158 assert_path_exists @a_1_1.gem_dir ensure FileUtils.chmod 0755, @gemhome - end unless win_platform? || Process.uid == 0 + end unless win_platform? || Process.uid.zero? def test_execute_dry_run @cmd.options[:args] = %w[a] Index: ruby_2_5/test/rubygems/test_gem_doctor.rb =================================================================== --- ruby_2_5/test/rubygems/test_gem_doctor.rb (revision 62836) +++ ruby_2_5/test/rubygems/test_gem_doctor.rb (revision 62837) @@ -24,7 +24,7 @@ class TestGemDoctor < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/rubygems/test_gem_doctor.rb#L24 FileUtils.rm b.spec_file - open c.spec_file, 'w' do |io| + File.open c.spec_file, 'w' do |io| (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/