ruby-changes:26845
From: drbrain <ko1@a...>
Date: Wed, 23 Jan 2013 06:46:07 +0900 (JST)
Subject: [ruby-changes:26845] drbrain:r38897 (trunk): * lib/rubygems/test_case.rb: Use Dir.tmpdir for rubygems tests instead
drbrain 2013-01-23 06:43:44 +0900 (Wed, 23 Jan 2013) New Revision: 38897 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38897 Log: * lib/rubygems/test_case.rb: Use Dir.tmpdir for rubygems tests instead of ./tmp/test. Fixes [ruby-trunk - Bug #7717] Modified files: trunk/ChangeLog trunk/lib/rubygems/test_case.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 38896) +++ ChangeLog (revision 38897) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Jan 23 06:43:26 2013 Eric Hodel <drbrain@s...> + + * lib/rubygems/test_case.rb: Use Dir.tmpdir for rubygems tests instead + of ./tmp/test. Fixes [ruby-trunk - Bug #7717] + Tue Jan 22 22:58:03 2013 Akinori MUSHA <knu@i...> * misc/ruby-electric.el (ruby-electric-curlies): Fix the bug where Index: lib/rubygems/test_case.rb =================================================================== --- lib/rubygems/test_case.rb (revision 38896) +++ lib/rubygems/test_case.rb (revision 38897) @@ -118,8 +118,8 @@ class Gem::TestCase < MiniTest::Unit::Te https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L118 @current_dir = Dir.pwd @ui = Gem::MockGemUi.new - # Need to do this in the project because $SAFE fucks up _everything_ - tmpdir = File.expand_path("tmp/test") + tmpdir = File.expand_path Dir.tmpdir + tmpdir.untaint if ENV['KEEP_FILES'] then @tempdir = File.join(tmpdir, "test_rubygems_#{$$}.#{Time.now.to_i}") @@ -127,6 +127,17 @@ class Gem::TestCase < MiniTest::Unit::Te https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L127 @tempdir = File.join(tmpdir, "test_rubygems_#{$$}") end @tempdir.untaint + + FileUtils.mkdir_p @tempdir + + # This makes the tempdir consistent on OS X. + # File.expand_path Dir.tmpdir #=> "/var/..." + # Dir.chdir Dir.tmpdir do File.expand_path '.' end #=> "/private/var/..." + Dir.chdir @tempdir do + @tempdir = File.expand_path '.' + @tempdir.untaint + end + @gemhome = File.join @tempdir, 'gemhome' @userhome = File.join @tempdir, 'userhome' -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/