From: tprobinson93@... Date: 2018-07-10T23:12:35+00:00 Subject: [ruby-core:87895] [Ruby trunk Misc#14905] Strange behavior in Dir.glob using ** operator Issue #14905 has been reported by trobinson (Trevor Robinson). ---------------------------------------- Misc #14905: Strange behavior in Dir.glob using ** operator https://bugs.ruby-lang.org/issues/14905 * Author: trobinson (Trevor Robinson) * Status: Open * Priority: Normal * Assignee: ---------------------------------------- Hello, I didn't want to report this as a bug because I'm not sure if it's intentional or not. The documentation didn't say either way. The `**` operator appears to work somewhat strangely when used in certain contexts. An example setup to trigger the odd behavior looks something like this: ~~~ text human_records ��� person1 ��� records.yml ��� person2 ��� other_records.yml cloud_records ��� AWS ��� project1 ��� records.yml ��� ��� project2 ��� records.yml ��� Azure ��� azproj1 ��� records.yml ~~~ Though the documentation doesn't say to do this, because of my experience with other globbing libraries, I did the following: ~~~ ruby Dir.glob("human_records/**.{yml,yaml}") # => ["human-records/person1/records.yml", "human_records/person2/other_records.yml"] Dir.glob("cloud_records/**.{yml,yaml}") # => [] ~~~ So using `**` like this works if there is only one level of folders between the root and the target files, as if the glob was `"records/*/*.{yml,yaml}"`. This seems like undefined behavior, so I thought I would bring it to your attention. If a change isn't a good solution to this, would a note in the documentation about undefined behavior around `**` be warranted? -- https://bugs.ruby-lang.org/ Unsubscribe: