Issue #8258 has been updated by Eregon (Benoit Daloze).


What is more worrying is implementations differ quite a bit in treating \ as an escape for these glob characters ({,},[,],*,?).

From my tests:
- MRI handle them fine
- Rubinius does not handle escaped [, { and }.
- JRuby does not handle escaped [ and ]
(For details, see https://travis-ci.org/eregon/path/builds/6326360)

If I am not mistaken, escaping is as simple as: dir.gsub(/\[|\]|\*|\?|\{|\}/, '\\\\' + '\0').
----------------------------------------
Feature #8258: Dir#escape_glob
https://bugs.ruby-lang.org/issues/8258#change-38540

Author: steveklabnik (Steve Klabnik)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


This is inspired by https://github.com/rails/rails/issues/6010.

Basically, if you do a Dir.glob in a directory whose name contains a glob character, things break. It would be nice to have a method which would escape the input so that we can Dir.glob inside of those directories.


-- 
http://bugs.ruby-lang.org/