Project

General

Profile

Actions

Bug #1378

closed

Dir.glob should not convert entries on UNIX

Added by ujihisa (Tatsuhiro Ujihisa) almost 15 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
Backport:
[ruby-dev:38305]

Description

=begin
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;
    =end
Actions #1

Updated by nobu (Nobuyoshi Nakada) almost 15 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r23189.
=end

Actions

Also available in: Atom PDF

Like0
Like0