Backport #7911
closed特定の条件の時に、File.fnmatchに渡すpatternがUS-ASCII、pathがUTF-8だとInvalid sequenceでエラーが出る
Description
=begin
coding: utf-8¶
File.fnmatch('a'.encode('US-ASCII'), 'あ', File::FNM_CASEFOLD)
というコードを実行した際に、
test-fnmatch.rb:2:in fnmatch': invalid byte sequence in US-ASCII (ArgumentError) from test-fnmatch.rb:2:in
'
というエラーが発生します。UTF-8文字列である'あ'を、'a'と同じUS-ASCIIだとしてcase insenstiveなマッチのためにupcaseを試みているのがエラー原因と思われます。
添付のパッチで動作するようになることを確認しました。
=end
Files
Updated by ko1 (Koichi Sasada) almost 12 years ago
- Category set to M17N
- Assignee set to naruse (Yui NARUSE)
- Target version set to 2.1.0
naruse さんに 2.1.0 として振りますが、2.0.0 に必要かどうかはご判断下さい。
Updated by nobu (Nobuyoshi Nakada) almost 12 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r39413.
Shunsuke, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
dir.c: encoding check
- dir.c (file_s_fnmatch, fnmatch_brace): encoding-incompatible pattern
and string do not match, instead of exception. [ruby-dev:47069]
[Bug #7911]
Updated by nobu (Nobuyoshi Nakada) almost 12 years ago
- Tracker changed from Bug to Backport
- Project changed from Ruby master to Backport200
- Category deleted (
M17N) - Status changed from Closed to Assigned
- Assignee changed from naruse (Yui NARUSE) to mame (Yusuke Endoh)
- Target version deleted (
2.1.0)
Updated by nagachika (Tomoyuki Chikanaga) almost 12 years ago
- Assignee changed from mame (Yusuke Endoh) to nagachika (Tomoyuki Chikanaga)
Updated by nagachika (Tomoyuki Chikanaga) almost 12 years ago
- Status changed from Assigned to Closed
This issue was solved with changeset r39662.
Shunsuke, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
merge revision(s) 39413: [Backport #7911]
* dir.c (file_s_fnmatch, fnmatch_brace): encoding-incompatible pattern
and string do not match, instead of exception. [ruby-dev:47069]
[Bug #7911]