Skip to content

Dir.glob returns doubles, if used with recursive directory matchers "**" #4353

@MartinKoerner

Description

@MartinKoerner

Environment

  • Mac OS Sierra 10.12.1
  • Directory structure with multiple subdirectories:
   tmp
    |\2
       |\abc
       |   \2 - file1.pdf
       |   \4 - file2.pdf
       |\def
       |   \2 - file3.pdf
       |   \4 - file4.pdf

Expected Behavior

   # MRI
   # rbenv shell 2.3.1
   # irb
      Dir.glob("tmp").size # = 1
      Dir.glob("tmp/2/abc/2/*.pdf").size # = 1
      Dir.glob("tmp/**/**/**/*.pdf").size # = 4

Actual Behavior

   # rbenv shell jruby-9.1.6.0
   # jirb
     Dir.glob("tmp").size # = 1
     Dir.glob("tmp/2/abc/2/*.pdf").size # = 1
     Dir.glob("tmp/**/**/**/*.pdf").size # = 12 <- WRONG!
     Dir.glob("tmp/**/**/**/*.pdf").uniq.size # 4 # doubles are equals according to String

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions