Repository navigation
grep: treat empty-bound intervals {,} and \{,\} as {0,} - #250
yunusarda-sudo wants to merge 1 commit into
Conversation
Rewrite unescaped, out-of-bracket `\{,\}` (BRE) and `{,}` (ERE) to `\{0,\}` / `{0,}` before compiling with Oniguruma, matching GNU grep.
Fixes uutils#203
Merging this PR will not alter performanceWarning uutils has exceeded the Hobby plan limit of 5 active contributors. Upgrade your plan or apply to the open source program by December 8, 2026 to keep using CodSpeed. 1 warning
Comparing Footnotes
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #250 +/- ##
==========================================
+ Coverage 97.19% 97.26% +0.06%
==========================================
Files 6 6
Lines 2248 2300 +52
Branches 243 247 +4
==========================================
+ Hits 2185 2237 +52
Misses 63 63
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
lhecker
left a comment
There was a problem hiding this comment.
We have 15 regex parsers now. I don't feel like we should have more. May as well just write a regex engine then.
|
Fair. Oniguruma rejects |
GNU grep treats an interval with neither bound (
\{,\}in BRE,{,}in ERE) as{0,}(zero or more). Oniguruma'sSYNTAX_BEHAVIOR_ALLOW_INTERVAL_LOW_ABBREVonly covers{,n}with an upper bound, so\{,\}failed in BRE and{,}was read literally in ERE.This normalizes unescaped, out-of-bracket
\{,\}(BRE) and{,}(ERE) to\{0,\}/{0,}before leading-operator stripping and regex compilation, leaving-Fand-Puntouched.Fixes #203
Investigated and verified locally with
cargo fmt --check,cargo clippy --all-targets -- -D warnings, andcargo test.