You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
-P accepts multiple patterns where GNU allows only one #34
GNU grep's PCRE backend (-P) supports only a single pattern; supplying more than one — via multiple -e, or a single pattern that contains a newline — is rejected with the -P option only supports a single pattern and exit 2. uu_grep accepts multiple patterns under -P and runs the search.
Found by the differential fuzzer (fuzz_grep).
Rust (incorrect)
$ printf'abc\n'| ./target/release/grep -P -e a -e b
abc
# Exit code: 0
GNU (correct)
$ printf'abc\n'| LC_ALL=C /usr/bin/grep -P -e a -e b
# Output (stderr): grep: the -P option only supports a single pattern# Exit code: 2
With -E/-G/-F, multiple -e patterns are accepted by both — the restriction is specific to -P.
Activity
fix: reject multiple patterns when -P/--perl-regexp is used