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

ruby-changes:35529

From: usa <ko1@a...>
Date: Wed, 17 Sep 2014 15:10:00 +0900 (JST)
Subject: [ruby-changes:35529] usa:r47611 (ruby_2_0_0): merge revision(s) 47591: [Backport #10242]

usa	2014-09-17 15:09:51 +0900 (Wed, 17 Sep 2014)

  New Revision: 47611

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

  Log:
    merge revision(s) 47591: [Backport #10242]
    
    * ext/pathname/lib/pathname.rb (SAME_PATHS):
      Pathname#relative_path_from uses String#casecmp to compare strings
      on case-insensitive filesystem platforms (e.g., Windows). This can
      return nil for strings with different encodings, and the code
      previously assumed that it always returned a Fixnum.  [Fix GH-713]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/ext/pathname/lib/pathname.rb
    branches/ruby_2_0_0/test/pathname/test_pathname.rb
    branches/ruby_2_0_0/version.h
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 47610)
+++ ruby_2_0_0/ChangeLog	(revision 47611)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Wed Sep 17 15:09:16 2014  Natalie Weizenbaum  <nweiz@g...>
+
+	* ext/pathname/lib/pathname.rb (SAME_PATHS):
+	  Pathname#relative_path_from uses String#casecmp to compare strings
+	  on case-insensitive filesystem platforms (e.g., Windows). This can
+	  return nil for strings with different encodings, and the code
+	  previously assumed that it always returned a Fixnum.  [Fix GH-713]
+
 Wed Sep 17 15:07:35 2014  Sho Hashimoto  <sho.hsmt@g...>
 
 	* ext/fiddle/lib/fiddle/import.rb (Fiddle::Importer#sizeof): fix typo,
Index: ruby_2_0_0/ext/pathname/lib/pathname.rb
===================================================================
--- ruby_2_0_0/ext/pathname/lib/pathname.rb	(revision 47610)
+++ ruby_2_0_0/ext/pathname/lib/pathname.rb	(revision 47611)
@@ -22,7 +22,8 @@ class Pathname https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ext/pathname/lib/pathname.rb#L22
   end
 
   SAME_PATHS = if File::FNM_SYSCASE.nonzero?
-    proc {|a, b| a.casecmp(b).zero?}
+    # Avoid #zero? here because #casecmp can return nil.
+    proc {|a, b| a.casecmp(b) == 0}
   else
     proc {|a, b| a == b}
   end
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 47610)
+++ ruby_2_0_0/version.h	(revision 47611)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2014-09-17"
-#define RUBY_PATCHLEVEL 573
+#define RUBY_PATCHLEVEL 574
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 9
Index: ruby_2_0_0/test/pathname/test_pathname.rb
===================================================================
--- ruby_2_0_0/test/pathname/test_pathname.rb	(revision 47610)
+++ ruby_2_0_0/test/pathname/test_pathname.rb	(revision 47611)
@@ -1306,4 +1306,17 @@ class TestPathname < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/pathname/test_pathname.rb#L1306
       assert_equal("foo/bar", File.join(Pathname.new("foo"), Pathname.new("bar").taint))
     }.call
   end
+
+  def test_relative_path_from_casefold
+    assert_separately([], <<-'end;') #    do
+      module File::Constants
+        remove_const :FNM_SYSCASE
+        FNM_SYSCASE = FNM_CASEFOLD
+      end
+      require 'pathname'
+      foo = Pathname.new("fo\u{f6}")
+      bar = Pathname.new("b\u{e4}r".encode("ISO-8859-1"))
+      assert_instance_of(Pathname, foo.relative_path_from(bar))
+    end;
+  end
 end

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r47591


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

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