1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

High Sierra's APFS cannot use invalid filenames [Bug #13816]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2017-08-15 21:33:43 +00:00
parent aa0f1dcbda
commit 5c63fc682c

View file

@ -1,6 +1,7 @@
# frozen_string_literal: false # frozen_string_literal: false
require 'test/unit' require 'test/unit'
require 'tmpdir' require 'tmpdir'
require '-test-/file'
class TestDir_M17N < Test::Unit::TestCase class TestDir_M17N < Test::Unit::TestCase
def with_tmpdir def with_tmpdir
@ -59,6 +60,8 @@ class TestDir_M17N < Test::Unit::TestCase
def test_filename_extutf8_invalid def test_filename_extutf8_invalid
return if /cygwin/ =~ RUBY_PLATFORM return if /cygwin/ =~ RUBY_PLATFORM
# High Sierra's APFS cannot use invalid filenames
return if Bug::File::Fs.fsname(Dir.tmpdir) == "apfs"
with_tmpdir {|d| with_tmpdir {|d|
assert_separately(%w[-EASCII-8BIT], <<-'EOS', :chdir=>d) assert_separately(%w[-EASCII-8BIT], <<-'EOS', :chdir=>d)
filename = "\xff".force_encoding("ASCII-8BIT") # invalid byte sequence as UTF-8 filename = "\xff".force_encoding("ASCII-8BIT") # invalid byte sequence as UTF-8
@ -375,7 +378,12 @@ class TestDir_M17N < Test::Unit::TestCase
a = "file_one*".force_encoding Encoding::IBM437 a = "file_one*".force_encoding Encoding::IBM437
b = "file_two*".force_encoding Encoding::EUC_JP b = "file_two*".force_encoding Encoding::EUC_JP
assert_equal([a, b].map(&:encoding), Dir[a, b].map(&:encoding)) 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) Dir.mkdir(dir)
list << dir list << dir
bug12081 = '[ruby-core:73868] [Bug #12081]' bug12081 = '[ruby-core:73868] [Bug #12081]'