On Feb 15, 2009, at 18:33 , Charles Oliver Nutter wrote:

> Ryan Davis wrote:
>> As Nobu and Akira have pointed out, dupes are entirely dependent on  
>> the pattern involved. If there is no "{...}" in the glob pattern,  
>> there should be no dupes at all. If there is, then it depends on  
>> how they evaluate:
>
> And why should dupes be specified behavior? Why would no dupes be a  
> breaking behavior?

I haven't the faintest why you'd ask these questions of me. They're  
specified behavior because they're specified behavior (ie, that's how  
matz designed it). The behavior seems perfectly sane to me (glob  
braces == unions. globs are not sets).

I think commit fa2bef33 is in error:

> 511 % git show fa2bef33
> commit fa2bef332e261985d7af709654ae313dad945f68
> Author: Charles Nutter <charles.nutter / sun.com>
> Date:   Sat Feb 14 01:51:52 2009 -0600
>
>     Add .uniq to some glob specs to filter out dupes.
>
>     I sent email to ruby-core about glob sometimes returning dupes.  
> It seems
>     odd that there would be dupes, but MRI does appear to return  
> them for at
>     least one case. If ruby-core decides glob should never return  
> dupes, the
>     spec expecting dupes is a ruby_bug. If they decide it may return  
> dupes,
>     the spec I was working on for JRuby is in error and uniq is  
> correct. We
>     shall see.
>
> diff --git a/core/dir/shared/glob.rb b/core/dir/shared/glob.rb
> index c6fd3f7..a48ed5e 100644
> --- a/core/dir/shared/glob.rb
> +++ b/core/dir/shared/glob.rb
> @@ -201,7 +201,7 @@ describe :dir_glob, :shared => true do
>    end
>
>    it "recursively matches directories with '**/<characters>'" do
> -    Dir.send(@method, '**/*fil?{,.}*').sort.should ==
> +    Dir.send(@method, '**/*fil?{,.}*').uniq.sort.should ==
>        %w[deeply/nested/directory/structure/file_one
>           deeply/nested/directory/structure/file_one.ext
>           deeply/nondotfile
> @@ -216,7 +216,6 @@ describe :dir_glob, :shared => true do
>
>           subdir_one/nondotfile
>           subdir_two/nondotfile
> -         subdir_two/nondotfile.ext
>           subdir_two/nondotfile.ext]
>    end
>  end
> @@ -249,6 +248,6 @@ describe :dir_glob_recursive, :shared => true do
>        a/x/b/y/e
>      ]
>
> -    Dir.send(@method, 'a/**/b/**/e').sort.should == expected
> +    Dir.send(@method, 'a/**/b/**/e').uniq.sort.should == expected
>    end
>  end