From: Brian Ford Date: 2009-02-15T05:41:22+09:00 Subject: [ruby-core:22108] Re: Dir.glob and duplicates? On Feb 14, 10:47�am, Charles Oliver Nutter wrote: > Nobuyoshi Nakada wrote: > > Hi, > > > At Sat, 14 Feb 2009 16:35:30 +0900, > > Charles Oliver Nutter wrote in [ruby-core:22065]: > >> The spec MRI produces dupes for is: > > >> Dir.glob recursively matches directories with '**/' > >> at core/dir/shared/glob.rb:205 > > > The pattern at line 204 is '**/*fil?{,.}*', which is equivalent > > to to Dir.glob('**/*fil?*')+Dir.glob('**/*fil?.*'), so > > "subdir_two/nondotfile.ext" matches against both. �That is, > > brace expansions needs attention to use. > > 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". Saying that there are duplicate entries because it emulates shell behaviors that are only present on _some_ platforms that Ruby runs on is flimsy justification at best. For everyone's sanity, I would strongly favor the "no dupes" over "may be dupes" or "undefined -- implementation specific". I'd really like to see a use case for dupes in anything that processes a list of filenames or the files themselves. Just to repeat, Ruby should not be forcing emulation of a partial set of platforms unless there is a compelling reason to do so. Cheers, Brian > > - Charlie