From: ujihisa Date: 2009-04-14T16:23:33+09:00 Subject: [ruby-dev:38305] Re: [BUG:1.9] Dir.glob should not convert entries on UNIX ujihisaといいます。 r23171 から、bracketを含むDir.globがうまく動いていませんでした。 $ ./ruby -e "p Dir.glob('/[ae]tc/')" [] 以下はパッチです。これを当てると、 mspec ./spec/rubyspec/core/dir/glob_spec.rb に通るようになります。 diff --git a/dir.c b/dir.c index 14b4872..dab55f7 100644 --- a/dir.c +++ b/dir.c @@ -136,9 +136,12 @@ bracket( else { if (ok) continue; if (r <= (send-s) && memcmp(p, s, r) == 0) continue; - if (!nocase) continue; - c1 = rb_enc_toupper(rb_enc_codepoint(s, send, enc), enc); - c2 = rb_enc_toupper(rb_enc_codepoint(p, pend, enc), enc); + c1 = rb_enc_codepoint(t1, t1 + strlen(t1), enc); + c2 = rb_enc_codepoint(s, send, enc); + if (nocase) { + c1 = rb_enc_toupper(c1, enc); + c2 = rb_enc_toupper(c2, enc); + } if (c1 != c2) continue; } ok = 1;