Repository navigation
grep: support POSIX collating symbols [[.c.]] in bracket expressions - #264
yunusarda-sudo wants to merge 3 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #264 +/- ##
==========================================
+ Coverage 97.28% 97.54% +0.25%
==========================================
Files 6 6
Lines 2287 2482 +195
Branches 247 276 +29
==========================================
+ Hits 2225 2421 +196
+ Misses 62 61 -1
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
|
In POSIX and GNU grep, a single-character collating symbol
[.c.]inside a bracket expression stands for that character in the C locale (e.g.[[.a.]]matchesa, and[^[:alnum:][.-.]_]is the standard way to put-into the character class).Multi-character names (like
[[.space.]]or[[.tab.]]) and empty symbols ([[..]]) are rejected by GNU grep withInvalid collation character(exit code 2). An unclosed[.within a bracket expression is rejected withUnmatched [, [^, [:, [., or [=.Previously,
uutils/greppassed bracket patterns directly to Oniguruma, which does not recognize[. ... .]syntax. As a result,[[.a.]]was interpreted as{[, ., a}followed by literal], matching the wrong characters and accepting invalid symbol names without errors.This change:
-G) and Extended (-E) modes.[.withUnmatched [, [^, [:, [., or [=and multi-character/empty symbols withInvalid collation character.-Ffixed strings and non-collating patterns unaffected with zero overhead.Fixes #158