summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-22 09:15:03 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-22 09:15:03 +0000
commit34a72a75aed9ff814a8b24a72193ba93f3217790 (patch)
tree867a3c38874fc71675a47a98c2b1512ba9c41675 /lib
parentdadc253d7e016c497867ab9e6ec2e0ae8d77285e (diff)
merge revision(s) 54307: [Backport #12193]
* lib/rubygems/test_case.rb: Fix test on Windows for inconsistent temp path. https://github.com/rubygems/rubygems/pull/1554 [Bug #12193][ruby-core:74431] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@54692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/test_case.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index 5dc7a1b67c..cd83453e14 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -250,6 +250,17 @@ class Gem::TestCase < MiniTest::Unit::TestCase
@tempdir.untaint
end
+ # This makes the tempdir consistent on Windows.
+ # Dir.tmpdir may return short path name, but Dir[Dir.tmpdir] returns long
+ # path name. https://bugs.ruby-lang.org/issues/10819
+ # File.expand_path or File.realpath doesn't convert path name to long path
+ # name. Only Dir[] (= Dir.glob) works.
+ # Short and long path name is specific to Windows filesystem.
+ if win_platform?
+ @tempdir = Dir[@tempdir][0]
+ @tempdir.untaint
+ end
+
@gemhome = File.join @tempdir, 'gemhome'
@userhome = File.join @tempdir, 'userhome'
ENV["GEM_SPEC_CACHE"] = File.join @tempdir, 'spec_cache'