Tanaka Akira wrote: > In article <49972FBE.3050503 / sun.com>, > Charles Oliver Nutter <charles.nutter / sun.com> writes: > > >> Well, if there are known issues with glob returning dupes, perhaps the >> specification should be "never returns dupes". It would seem rather >> foolish to write code expecting dupes in glob (other than expecting them >> and uniq'ing the result). So I think the only real solution is "never >> returns dupes" and the dupe-expecting spec would be a bug. >> > > I don't think it is a bug. > > Current behavior is clearly intentional. > > If it will be changed, it is specification change. > Maybe symlinks can produce real dup's ? Create file 'abc.ext' symlink1 & symlink2 to 'abc.ext' in same dir p Dir['*.ext'] I think returning real duplicates is a different matter from returning double-matches Dir[*{ab,bc}*] from a single file 'abc.ext'. It's not a duplicate file just because a pattern matches it twice, surely? dir.c has this doc ... /* * call-seq: * Dir.glob( pattern, [flags] ) => array * Dir.glob( pattern, [flags] ) {| filename | block } => nil * [-cut-] * <code>{p,q}</code>:: Matches either literal <code>p</code> or * literal <code>q</code>. Matching literals * may be more than one character in length. * More than two literals may be specified. * Equivalent to pattern alternation in * regexp. "Matches either p or q." It's not /"equivalent to pattern alternation in regexp"/ or else we'd expect two matches from this code: /(bc|ab)/ =~ 'zabc.ext' #=> 1 -- It matches at 1 AND 2 :)) I would report the bug to *nix shell people but there are too many shells. ;)) In Ruby, we should show them the correct way to prevent false "duplicates". Cheers, daz