Open
Description
Important
This issue was migrated from Trac:
Origin | https://midnight-commander.org/ticket/2309 |
---|---|
Reporter | wjaguar (@wjaguar) |
Function mc_search__glob_translate_to_regex() in lib/search/glob.c is horribly broken, and mishandles a number of trivial patterns such as:
- an inverted character class: "[^abc]" or "[!abc]"
- a freestanding comma: "abc,def"
- a literal brace: "{" or "}"
- an incorrectly formed brace expansion: "{abc}"
- a sequence expression: "{5..10}" or "{a..f}"
Also, a nested brace expansion: "a{b,c{d,e}}f" will produce capturing parentheses for every pair of braces, instead of only the outermost pair.
All this because current code is far too simple-minded to correctly convert Bash patterns into PCRE regexes, and needs a complete rewrite.
Note
Original attachments:
- glob-to-regex.patch (raw) by
boris
onDec 20, 2014 at 22:41 UTC
- glob4827.patch (raw) by
wjaguar
(@wjaguar) onFeb 26, 2025 at 22:39 UTC
- glob4833.patch (raw) by
wjaguar
(@wjaguar) onFeb 26, 2025 at 22:40 UTC
- glob_tests.c (raw) by
wjaguar
(@wjaguar) onFeb 26, 2025 at 22:41 UTC