ruby-changes:35514
From: nagachika <ko1@a...>
Date: Mon, 15 Sep 2014 23:11:17 +0900 (JST)
Subject: [ruby-changes:35514] nagachika:r47596 (ruby_2_1): merge revision(s) r47591: [Backport #10242]
nagachika 2014-09-15 23:11:00 +0900 (Mon, 15 Sep 2014) New Revision: 47596 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47596 Log: merge revision(s) r47591: [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_1/ Modified files: branches/ruby_2_1/ChangeLog branches/ruby_2_1/ext/pathname/lib/pathname.rb branches/ruby_2_1/test/pathname/test_pathname.rb branches/ruby_2_1/version.h Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 47595) +++ ruby_2_1/ChangeLog (revision 47596) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1 +Mon Sep 15 22:34:39 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] + Mon Sep 15 22:31:33 2014 Sho Hashimoto <sho.hsmt@g...> * ext/fiddle/lib/fiddle/import.rb (Fiddle::Importer#sizeof): fix typo, Index: ruby_2_1/ext/pathname/lib/pathname.rb =================================================================== --- ruby_2_1/ext/pathname/lib/pathname.rb (revision 47595) +++ ruby_2_1/ext/pathname/lib/pathname.rb (revision 47596) @@ -22,7 +22,8 @@ class Pathname https://github.com/ruby/ruby/blob/trunk/ruby_2_1/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_1/version.h =================================================================== --- ruby_2_1/version.h (revision 47595) +++ ruby_2_1/version.h (revision 47596) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #define RUBY_VERSION "2.1.2" #define RUBY_RELEASE_DATE "2014-09-15" -#define RUBY_PATCHLEVEL 239 +#define RUBY_PATCHLEVEL 240 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 9 Index: ruby_2_1/test/pathname/test_pathname.rb =================================================================== --- ruby_2_1/test/pathname/test_pathname.rb (revision 47595) +++ ruby_2_1/test/pathname/test_pathname.rb (revision 47596) @@ -1322,4 +1322,17 @@ class TestPathname < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/pathname/test_pathname.rb#L1322 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_1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r47591 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/