On Feb 14, 2009, at 10:47 , Charles Oliver Nutter wrote:

> I think the presence of duplicates is a glob implementation detail  
> that should not be specified. Surely different implementations are  
> going to produce difference results. I don't think we should specify  
> when dupes are expected to occur, and glob's specification should  
> either be "may produce dupes" or "will not produce dupes".

I disagree. I think the behavior as specced is not implementation  
dependent and it is consistent (tho possibly poorly documented/ 
specced--it has been a while for me since I read the specs for it).

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:

% ruby -e 'p Dir["/{etc,etc,etc}/passwd"]'
["/etc/passwd", "/etc/passwd", "/etc/passwd"]

vs

% ruby -e 'p Dir["/{etc,x,y}/passwd"]'
["/etc/passwd"]