Skip to content

"Shell patterns" broken beyond repair #2309

Open
@mc-butler

Description

@mc-butler

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:

Metadata

Metadata

Assignees

Labels

area: searchSearch subsystemprio: mediumHas the potential to affect progressver: 4.8.33Reproducible in version 4.8.33

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions