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

ruby-changes:50652

From: usa <ko1@a...>
Date: Sun, 18 Mar 2018 23:39:48 +0900 (JST)
Subject: [ruby-changes:50652] usa:r62814 (ruby_2_3): merge revision(s) 59602, 59887: [Backport #13816]

usa	2018-03-18 23:39:41 +0900 (Sun, 18 Mar 2018)

  New Revision: 62814

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

  Log:
    merge revision(s) 59602,59887: [Backport #13816]
    
    High Sierra's APFS cannot use invalid filenames [Bug #13816]
    
    added workaround for APFS file format.
    
      * TestFileExhaustive#test_atime: It fails with nano-sec precise.
        I changed to use unixtime for this assertion for APFS.
      * TestFileExhaustive#test_expand_path: skip assertion when given
        invalid charactor on APFS.
    
      [Bug #13816][ruby-core:82383]

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/test/ruby/test_dir_m17n.rb
    branches/ruby_2_3/test/ruby/test_file_exhaustive.rb
    branches/ruby_2_3/version.h
Index: ruby_2_3/test/ruby/test_dir_m17n.rb
===================================================================
--- ruby_2_3/test/ruby/test_dir_m17n.rb	(revision 62813)
+++ ruby_2_3/test/ruby/test_dir_m17n.rb	(revision 62814)
@@ -1,6 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_dir_m17n.rb#L1
 # frozen_string_literal: false
 require 'test/unit'
 require 'tmpdir'
+require '-test-/file'
 
 class TestDir_M17N < Test::Unit::TestCase
   def with_tmpdir
@@ -57,6 +58,8 @@ class TestDir_M17N < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_dir_m17n.rb#L58
   end
 
   def test_filename_extutf8_invalid
+    # High Sierra's APFS cannot use invalid filenames
+    return if Bug::File::Fs.fsname(Dir.tmpdir) == "apfs"
     with_tmpdir {|d|
       assert_separately(%w[-EASCII-8BIT], <<-'EOS', :chdir=>d)
         filename = "\xff".force_encoding("ASCII-8BIT") # invalid byte sequence as UTF-8
@@ -370,7 +373,12 @@ class TestDir_M17N < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_dir_m17n.rb#L373
       a = "file_one*".force_encoding Encoding::IBM437
       b = "file_two*".force_encoding Encoding::EUC_JP
       assert_equal([a, b].map(&:encoding), Dir[a, b].map(&:encoding))
-      dir = "\u{76EE 5F551}"
+      if Bug::File::Fs.fsname(Dir.pwd) == "apfs"
+        # High Sierra's APFS cannot use filenames with undefined character
+        dir = "\u{76EE}"
+      else
+        dir = "\u{76EE 5F551}"
+      end
       Dir.mkdir(dir)
       list << dir
       bug12081 = '[ruby-core:73868] [Bug #12081]'
Index: ruby_2_3/test/ruby/test_file_exhaustive.rb
===================================================================
--- ruby_2_3/test/ruby/test_file_exhaustive.rb	(revision 62813)
+++ ruby_2_3/test/ruby/test_file_exhaustive.rb	(revision 62814)
@@ -3,6 +3,7 @@ require "test/unit" https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_file_exhaustive.rb#L3
 require "fileutils"
 require "tmpdir"
 require "socket"
+require '-test-/file'
 
 class TestFileExhaustive < Test::Unit::TestCase
   DRIVE = Dir.pwd[%r'\A(?:[a-z]:|//[^/]+/[^/]+)'i]
@@ -554,7 +555,13 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_file_exhaustive.rb#L555
       t2 = File.open(file) {|f| f.atime}
       assert_kind_of(Time, t1)
       assert_kind_of(Time, t2)
-      assert_equal(t1, t2)
+      # High Sierra's APFS can handle nano-sec precise.
+      # t1 value is difference from t2 on APFS.
+      if Bug::File::Fs.fsname(Dir.tmpdir) == "apfs"
+        assert_equal(t1.to_i, t2.to_i)
+      else
+        assert_equal(t1, t2)
+      end
     end
     assert_raise(Errno::ENOENT) { File.atime(nofile) }
   end
@@ -730,6 +737,8 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_file_exhaustive.rb#L737
         begin
           open(file) {}
         rescue
+          # High Sierra's APFS cannot use filenames with undefined character
+          next if Bug::File::Fs.fsname(Dir.tmpdir) == "apfs"
           assert_equal(file, full_path, mesg)
         else
           assert_equal(regular_file, full_path, mesg)
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 62813)
+++ ruby_2_3/version.h	(revision 62814)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.7"
 #define RUBY_RELEASE_DATE "2018-03-18"
-#define RUBY_PATCHLEVEL 415
+#define RUBY_PATCHLEVEL 416
 
 #define RUBY_RELEASE_YEAR 2018
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 62813)
+++ ruby_2_3/ChangeLog	(revision 62814)
@@ -1,3 +1,19 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Sun Mar 18 23:36:24 2018  SHIBATA Hiroshi  <hsbt@r...>
+
+	added workaround for APFS file format.
+
+	* TestFileExhaustive#test_atime: It fails with nano-sec precise. I
+	  changed to use unixtime for this assertion for APFS.
+
+	* TestFileExhaustive#test_expand_path: skip assertion when given
+	  invalid charactor on APFS.
+
+	[Bug #13816]
+
+Sun Mar 18 23:36:04 2018  NARUSE, Yui  <naruse@r...>
+
+	High Sierra's APFS cannot use invalid filenames [Bug #13816]
+
 Sun Mar 18 23:31:44 2018  Nobuyoshi Nakada  <nobu@r...>
 
 	test_framework.rb: for case-sensitive filesystem
Index: ruby_2_3
===================================================================
--- ruby_2_3	(revision 62813)
+++ ruby_2_3	(revision 62814)

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /trunk:r59602,59887

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

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