[Bug:trunk] Dir.[] returns unmatched path

e$B1sF#$G$9!#e(B

mingw e$B$Ge(B sample/test.rb e$B$,<:GT$7$^$9!#D4$Y$F$_$k$H!"0J2<$Ne(B
Dir.[] e$B$Ne(B
e$B8F$S=P$77k2L$,$*$+$7$$$h$&$J5$$,$7$^$9!#e(B

$ cat t.rb
p Dir[“C:/Ruby/ruby/{lib,sample,ext,test}/**/*.rb”].sort.first

$ ./ruby t.rb
“C:/Ruby/ruby/”

glob e$B$N%Q%?!<%s$K%^%C%A$7$F$$$J$$$H;W$&$N$G$9$,!"$I$&$G$7$g$&$+!#e(B

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:40514] [Bug:trunk] Dir.[] returns unmatched path”
on Feb.27,2010 12:45:47, [email protected] wrote:

mingw e$B$Ge(B sample/test.rb e$B$,<:GT$7$^$9!#D4$Y$F$_$k$H!"0J2<$Ne(B Dir.[] e$B$Ne(B
e$B8F$S=P$77k2L$,$*$+$7$$$h$&$J5$$,$7$^$9!#e(B

$ cat t.rb
p Dir[“C:/Ruby/ruby/{lib,sample,ext,test}/**/*.rb”].sort.first

$ ./ruby t.rb
“C:/Ruby/ruby/”

glob e$B$N%Q%?!<%s$K%^%C%A$7$F$$$J$$$H;W$&$N$G$9$,!"$I$&$G$7$g$&$+!#e(B

e$B$H$j$"$($:!"e(B

ruby 1.9.2dev (2010-02-27 trunk 26772) [i386-mswin32]

e$B$G$O:F8=$7$^$;$se(B(ext/bigdecimal/[email protected]$7$/=&$C$F$-$^$9e(B)e$B!#e(B

Dir.[] e$B$K$;$he(B Array#sort e$B$K$;$he(B Array#first
e$B$K$;$he(Bmswine$B$He(Bmingw
e$B$G5sF0$K0c$$$O$J$$$O$:$G$9$,e(B…
e$B$H$3$m$G!"e(Bruby -v(e$B$H$$$&$+%j%S%8%g%se(B)e$B$Oe(B?

e$B$=$l$G$O!#e(B

e$B1sF#$G$9!#e(B

2010e$BG/e(B2e$B7ne(B27e$BF|e(B13:07 U.Nakamura [email protected]:

glob e$B$N%Q%?!<%s$K%^%C%A$7$F$$$J$$$H;W$&$N$G$9$,!"$I$&$G$7$g$&$+!#e(B

e$B$H$j$"$($:!"e(B

ruby 1.9.2dev (2010-02-27 trunk 26772) [i386-mswin32]

e$B$G$O:F8=$7$^$;$se(B(ext/bigdecimal/[email protected]$7$/=&$C$F$-$^$9e(B)e$B!#e(B

Dir.[] e$B$K$;$he(B Array#sort e$B$K$;$he(B Array#first e$B$K$;$he(Bmswine$B$He(Bmingw
e$B$G5sF0$K0c$$$O$J$$$O$:$G$9$,e(B…

e$B$"$l$l!#e(B

e$B$H$3$m$G!"e(Bruby -v(e$B$H$$$&$+%j%S%8%g%se(B)e$B$Oe(B?

e$B$"!"$9$_$^$;$s!#e(B

$ ./ruby -v t.rb
ruby 1.9.2dev (2010-02-26) [i386-mingw32]
“C:/Ruby/ruby/”

e$B$G$9!#e(B

e$BIT;W5D$J$3$H$Ke(B miniruby [email protected]$H$A$c$s$HF0$-$^$7$?!#e(B

$ ./miniruby.exe -v t.rb
ruby 1.9.2dev (2010-02-26) [i386-mingw32]
“C:/Ruby/ruby/ext/bigdecimal/extconf.rb”

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:40518] Re: [Bug:trunk] Dir.[] returns unmatched
path”
on Feb.27,2010 13:17:21, [email protected] wrote:

e$B$H$3$m$G!"e(Bruby -v(e$B$H$$$&$+%j%S%8%g%se(B)e$B$Oe(B?

e$B$"!"$9$_$^$;$s!#e(B

$ ./ruby -v t.rb
ruby 1.9.2dev (2010-02-26) [i386-mingw32]
“C:/Ruby/ruby/”

e$B$G$9!#e(B

e$B$U$&$`!"$A$J$_$K$3$A$i$G$Oe(B2010-02-08e$B$G$bBg>fIW$G$7$?!#e(B

e$BIT;W5D$J$3$H$Ke(B miniruby [email protected]$H$A$c$s$HF0$-$^$7$?!#e(B

$ ./miniruby.exe -v t.rb
ruby 1.9.2dev (2010-02-26) [i386-mingw32]
“C:/Ruby/ruby/ext/bigdecimal/extconf.rb”

e$B$J$K$=$l$3$o$$!#e(B

minirubye$B$He(Brubye$B$Ge(Bglobe$B$K0c$$$O$J$$$h$&$Je(B… …
e$B$"!"$"$j$^$7$?!#e(Bencodinge$BMm$_!#e(B
e$B$G$b%7%9%F%`$+$i<h$C$F$k$+$i$d$C$Q$jF1$87k2L$K$J$k$h$&$J5$$be(B
[email protected]$1$I$J$"!#e(B

e$B$=$l$G$O!#e(B

e$B1sF#$G$9!#e(B

2010e$BG/e(B4e$B7ne(B9e$BF|e(B19:08 Masaya TARUI [email protected]:

e$B85$r$?$I$l$Pe(Bpush_globe$B4X?tFb$Ge(BRSTRING_PTR(str)e$B$rEO$7$F$$$k$N$K!"e(B
stre$B$,e(BGCe$B$Ge(Bmarke$B$5$l$:$K2s<}$5$l$k$?$a$J$N$G!"e(B

e$B0J2<$Ne(Bpatche$B!Je(BIRCe$B$G65$($F$b$i$C$?e(Bpatche$B$G$9$,e(B)e$B$GD>$k;v$r3NG’$7$^$7$?!#e(B

e$B$b$&<j85$Ne(B mingw
e$B4D6-$O>C$7$F$7$^$C$?$N$G:F;n$O$7$F$$$J$$$N$G$9$,!“e(B
[email protected]$i$+$K$^$:$$%3!<%I$G$”$j!"C.2H$5$s$N4D6-$G$OD>$k$H$N$3$H$J$N$G!"e(B
e$B<h$j9~$_$^$7$?!#e(B

e$B$9$P$i$7$$D4::$G$7$?!#$"$j$,$H$&$4$6$$$^$9!#e(B

e$B%A%1%C%He(B #2821 e$B$,99?7$5$l$^$7$?!#e(B (by Yusuke E.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

This issue was solved with changeset r27268.
Yusuke, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


http://redmine.ruby-lang.org/issues/show/2821

e$BC.2H$H$$$$$^$9!#e(B

dir.ce$B$K$$$$F!“e(Bruby_brace_expande$B4X?t$Ne(Bstre$B$,e(Bwhile(p<rbrace)e$B%k!<%WFb$NESCf$G2u$l$Fe(B
e$BITDj$K$J$k$N$,D>@$N860x$G$7$?!#e(B
GCe$B$,5/$-$k$H2u$l$k$N$G!”@x:_E
$KLdBj$N$"$C$?4D6-$G$O!“e(B
100.times{
a=
Dir[”#{dir}{ext,ext,ext,ext,ext,ext,ext,ext,ext,ext,ext,ext,ext,ext,ext,ext,ext,ext,ext,ext,ext,ext,ext,ext,ext,ext,win32}/**/*.rb"].sort

p [a.select{|i| i=~/win32/}.size,a.size,a[0]]
}
e$B$H$+$9$k$He(BSEGVe$B$r4^$a$*$+$7$J7k2L$r=P$9$H;W$$$^$9!#e(B

e$B85$r$?$I$l$Pe(Bpush_globe$B4X?tFb$Ge(BRSTRING_PTR(str)e$B$rEO$7$F$$$k$N$K!"e(B
stre$B$,e(BGCe$B$Ge(Bmarke$B$5$l$:$K2s<}$5$l$k$?$a$J$N$G!"e(B

e$B0J2<$Ne(Bpatche$B!Je(BIRCe$B$G65$($F$b$i$C$?e(Bpatche$B$G$9$,e(B)e$B$GD>$k;v$r3NG’$7$^$7$?!#e(B

#GCe$BI]$$e(B

svn diff dir.c
Index: dir.c
===================================================================
— dir.c (e$B%j%S%8%g%se(B 27267)
+++ dir.c (e$B:n6H%3%T!<e(B)
@@ -1622,14 +1622,17 @@
{
struct glob_args args;
rb_encoding *enc = rb_enc_get(str);

  • int ret;

    if (enc == rb_usascii_encoding()) enc = rb_filesystem_encoding();
    args.func = push_pattern;
    args.value = ary;
    args.enc = enc;

  • return ruby_brace_glob0(RSTRING_PTR(str), flags | GLOB_VERBOSE,
  •                       rb_glob_caller, (VALUE)&args, enc);
    
  • ret = ruby_brace_glob0(RSTRING_PTR(str), flags | GLOB_VERBOSE,
  •                      rb_glob_caller, (VALUE)&args, enc);
    
  • RB_GC_GUARD(str);
  • return ret;
    }

static VALUE

2010e$BG/e(B2e$B7ne(B27e$BF|e(B13:35 U.Nakamura [email protected]:

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:40939] Re: [Bug:trunk] Dir.[] returns
unmatched path”
on Fri, 9 Apr 2010 19:08:26 +0900, Masaya TARUI [email protected]
writes:

|e$B85$r$?$I$l$Pe(Bpush_globe$B4X?tFb$Ge(BRSTRING_PTR(str)e$B$rEO$7$F$$$k$N$K!"e(B
|stre$B$,e(BGCe$B$Ge(Bmarke$B$5$l$:$K2s<}$5$l$k$?$a$J$N$G!"e(B
|
|e$B0J2<$Ne(Bpatche$B!Je(BIRCe$B$G65$($F$b$i$C$?e(Bpatche$B$G$9$,e(B)e$B$GD>$k;v$r3NG’$7$^$7$?!#e(B

e$B$"$j$,$H$&$4$6$$$^$9!#:3:[email protected]$($Pe(B RB_GC_GUARD
[email protected]$K$e(B
e$B$$$F$
$1$P!"e(Bret e$B$KLa$jCM$rJ]B8$9$kI,MW$O$J$$$h$&$K;W$$$^$9!#e(B

e$B$D$^$je(B

RB_GC_GUARD(str);
return ruby_brace_glob0(RSTRING_PTR(str), flags | GLOB_VERBOSE,
                        rb_glob_caller, (VALUE)&args, enc);

e$B$H$$$&$3$H!#e(B

e$B1sF#$G$9!#e(B

2010e$BG/e(B4e$B7ne(B9e$BF|e(B20:21 Yukihiro M.
[email protected]:

e$B$"$j$,$H$&$4$6$$$^$9!#:3:[email protected]$($Pe(B RB_GC_GUARD [email protected]$K$e(B
e$B$$$F$
$1$P!"e(Bret e$B$KLa$jCM$rJ]B8$9$kI,MW$O$J$$$h$&$K;W$$$^$9!#e(B

e$B$D$^$je(B

RB_GC_GUARD(str);
return ruby_brace_glob0(RSTRING_PTR(str), flags | GLOB_VERBOSE,
rb_glob_caller, (VALUE)&args, enc);

e$B$H$$$&$3$H!#e(B

e$B$&!"3N$+$K!#e(B
e$B$=$N%Q%C%A$r=q$$$?$N$O;d$J$N$G!"D>$7$F$*$-$^$9!#e(B

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs