[前][次][番号順一覧][スレッド一覧]

ruby-changes:42233

From: hsbt <ko1@a...>
Date: Mon, 28 Mar 2016 11:02:42 +0900 (JST)
Subject: [ruby-changes:42233] hsbt:r54307 (trunk): * lib/rubygems/test_case.rb: Fix test on Windows for inconsistent temp path.

hsbt	2016-03-28 11:02:37 +0900 (Mon, 28 Mar 2016)

  New Revision: 54307

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54307

  Log:
    * 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]

  Modified files:
    trunk/ChangeLog
    trunk/lib/rubygems/test_case.rb
Index: lib/rubygems/test_case.rb
===================================================================
--- lib/rubygems/test_case.rb	(revision 54306)
+++ lib/rubygems/test_case.rb	(revision 54307)
@@ -252,6 +252,17 @@ class Gem::TestCase < MiniTest::Unit::Te https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L252
       @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'
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 54306)
+++ ChangeLog	(revision 54307)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Mar 28 11:02:31 2016  Hiroshi Shirosaki  <h.shirosaki@g...>
+
+	* 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@r...>
 
 	* sprintf.c (rb_str_format): refactor floating point format of

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]