ruby-changes:65036
From: Nobuyoshi <ko1@a...>
Date: Sun, 24 Jan 2021 23:35:27 +0900 (JST)
Subject: [ruby-changes:65036] 30f11e73c4 (master): Revert "Remove temporary directory properly"
https://git.ruby-lang.org/ruby.git/commit/?id=30f11e73c4 From 30f11e73c43672833b301ef89eca25d430e2480f Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 24 Jan 2021 23:26:11 +0900 Subject: Revert "Remove temporary directory properly" This reverts commit 80bad36989bbc4ad6167fe9670327f95b78089ce, because a few CI machines fail continuously. --- lib/rubygems/test_case.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb index 2fbdd4f..83a3c44 100644 --- a/lib/rubygems/test_case.rb +++ b/lib/rubygems/test_case.rb @@ -301,6 +301,9 @@ class Gem::TestCase < Minitest::Test https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L301 def setup @orig_env = ENV.to_hash + @tmp = File.expand_path("tmp") + + FileUtils.mkdir_p @tmp ENV['GEM_VENDOR'] = nil ENV['GEMRC'] = nil @@ -309,6 +312,7 @@ class Gem::TestCase < Minitest::Test https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L312 ENV['XDG_DATA_HOME'] = nil ENV['SOURCE_DATE_EPOCH'] = nil ENV['BUNDLER_VERSION'] = nil + ENV["TMPDIR"] = @tmp @current_dir = Dir.pwd @fetcher = nil @@ -319,10 +323,13 @@ class Gem::TestCase < Minitest::Test https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L323 # capture output Gem::DefaultUserInteraction.ui = Gem::MockGemUi.new - tmpdir = File.realpath(Dir.mktmpdir("test_rubygems_")) + tmpdir = File.realpath Dir.tmpdir tmpdir.tap(&Gem::UNTAINT) - ENV["TMPDIR"] = @tmp = File.dirname(tmpdir) - @tempdir = tmpdir + + @tempdir = File.join(tmpdir, "test_rubygems_#{$$}") + @tempdir.tap(&Gem::UNTAINT) + + FileUtils.mkdir_p @tempdir @orig_SYSTEM_WIDE_CONFIG_FILE = Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/