Repository navigation
grep: reject chained range operators like [a-c-e] in bracket expressions - #248
yunusarda-sudo wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #248 +/- ##
=======================================
Coverage 97.22% 97.22%
=======================================
Files 6 6
Lines 2270 2271 +1
Branches 245 245
=======================================
+ Hits 2207 2208 +1
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:
|
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
98f4de8 to
471cbb6
Compare
|
Cygwin failure is unrelated: |
GNU grep rejects bracket expressions with chained ranges like [a-c-e] with "Invalid range end" (exit 2) in both basic and extended mode. Disable ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC in extended mode and translate ONIGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS into "Invalid range end". Fixes uutils#163 Signed-off-by: Yunus Arda Güney <[email protected]>
471cbb6 to
28cde0d
Compare
A bracket expression cannot chain range operators: in
[a-c-e]the second-has a range as its left endpoint, and GNU grep rejects it withInvalid range end(exit 2) in both basic and extended mode.Previously,
grep -EenabledSYNTAX_BEHAVIOR_ALLOW_DOUBLE_RANGE_OP_IN_CCviaSyntax::gnu_regex()and accepted it as[a-c],-,e. In basic mode, Oniguruma rejected it with an untranslated internal error message.This PR disables
SYNTAX_BEHAVIOR_ALLOW_DOUBLE_RANGE_OP_IN_CCunder-Eand mapsONIGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASSto"Invalid range end", matching GNU grep behavior in both modes.Fixes #163