Dir#glob and escaped commas #1842

Closed
robin850 opened this Issue Jul 21, 2014 · 1 comment

Projects

None yet

2 participants

@robin850
Contributor

Hello,

Dealing with a glob wrapped inside braces and a folder name containing commas, JRuby will ignore the escaping on commas and consider that the glob is in two parts so for instance, in the following example, JRuby will search for text files on the whole disk :

>> glob = '{i\,dont\,exist\,/**/*.txt}';

>> RUBY_ENGINE
=> "jruby"
>> Dir[glob]
=> ["/install.txt", "/etc/urls.txt", ...]

>> RUBY_ENGINE
=> "ruby"
>> Dir[glob]
=> []

For the record, this makes this test to fail in the Ruby on Rails test suite as searching files on the whole disk takes time and the Thread running this statement only has 5 seconds to run.

A RubySpec has been added for that in rubyspec/rubyspec#281.

Have a nice day.

@kares kares added this to the JRuby 9.1.8.0 milestone Jan 20, 2017
@kares kares self-assigned this Jan 20, 2017
@kares kares closed this in 9c88738 Jan 20, 2017
@kares kares added a commit to kares/jruby that referenced this issue Jan 20, 2017
@kares kares consider escaped comas in glob pattern (resolves #1842) e927035
@robin850
Contributor

@kares : Thank you very much ! :-) ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment