aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-28 02:02:37 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-28 02:02:37 +0000
commit6cc4937aec6596bff58fc946b4b00c7b546e494a (patch)
treeca3f5b6f726b9be0596353d8a29d095b67619e7b
parent7d378a5b3adefa8d3ab3b436a382daeb018d99ef (diff)
downloadruby-6cc4937aec6596bff58fc946b4b00c7b546e494a.tar.gz
* 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/trunk@54307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--lib/rubygems/test_case.rb11
2 files changed, 17 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index a4191f1f1d..685267f540 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Mon Mar 28 11:02:31 2016 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * 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]
+
Mon Mar 28 08:19:49 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* sprintf.c (rb_str_format): refactor floating point format of
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index 0864f33478..bde4ed6713 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -252,6 +252,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'