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

ruby-changes:42181

From: nobu <ko1@a...>
Date: Fri, 25 Mar 2016 01:10:48 +0900 (JST)
Subject: [ruby-changes:42181] nobu:r54255 (trunk): mkmf: Unquote directory strings

nobu	2016-03-25 01:10:43 +0900 (Fri, 25 Mar 2016)

  New Revision: 54255

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

  Log:
    mkmf: Unquote directory strings
    
    * lib/mkmf.rb (find_executable0): On Windows, it is actually valid
      to surround individual PATH directory entries with double
      quotes. Remove these before joining the path as otherwise the
      literal quotes would become part of the path, resulting in the
      executable not to be found.  [Fix GH-1305]

  Modified files:
    trunk/ChangeLog
    trunk/lib/mkmf.rb
    trunk/test/mkmf/test_find_executable.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 54254)
+++ ChangeLog	(revision 54255)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Mar 25 01:10:42 2016  Sebastian Schuberth  <sschuberth@g...>
+
+	* lib/mkmf.rb (find_executable0): On Windows, it is actually valid
+	  to surround individual PATH directory entries with double
+	  quotes. Remove these before joining the path as otherwise the
+	  literal quotes would become part of the path, resulting in the
+	  executable not to be found.  [Fix GH-1305]
+
 Thu Mar 24 22:38:18 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* strftime.c (FMT, FMTV): remove recursive-assignments to get rid
Index: test/mkmf/test_find_executable.rb
===================================================================
--- test/mkmf/test_find_executable.rb	(revision 54254)
+++ test/mkmf/test_find_executable.rb	(revision 54255)
@@ -47,5 +47,12 @@ class TestMkmf https://github.com/ruby/ruby/blob/trunk/test/mkmf/test_find_executable.rb#L47
         assert_nil(result)
       end
     end
+
+    if /mingw|mswin/ =~ RUBY_PLATFORM
+      def test_quoted_path_on_windows
+        ENV["PATH"] = %["#{@tmpdir}"]
+        test_find_executable
+      end
+    end
   end
 end
Index: lib/mkmf.rb
===================================================================
--- lib/mkmf.rb	(revision 54254)
+++ lib/mkmf.rb	(revision 54255)
@@ -1551,6 +1551,7 @@ SRC https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L1551
     end
     file = nil
     path.each do |dir|
+      dir.sub!(/\A"(.*)"\z/m, '\1') if $mswin or $mingw
       return file if executable_file.call(file = File.join(dir, bin))
       if exts
         exts.each {|ext| executable_file.call(ext = file + ext) and return ext}

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

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