When two different matcher-selection flags are given on the same command line
(-F/--fixed-strings, -E/--extended-regexp, -G/--basic-regexp,
-P/--perl-regexp), GNU grep treats it as a usage error and exits with code
2 and the message conflicting matchers specified. uu_grep silently lets the
last flag win and performs the match, exiting 0/1.
Repeating the same matcher flag (e.g. -F -F) is accepted by both and is not
affected.
Rust (incorrect - accepts the conflict)
$ printf 'abc\n' | ./target/release/grep -e . -F -G
abc
# Exit code: 0
GNU (correct)
$ printf 'abc\n' | LC_ALL=C /usr/bin/grep -e . -F -G
grep: conflicting matchers specified
# Exit code: 2
Affected combinations
Every pairing of two different matcher types diverges (Rust accepts, GNU errors
with exit 2):
| flags |
uu_grep |
GNU |
-F -G |
0 |
2 |
-F -E |
0 |
2 |
-E -G |
0 |
2 |
-G -E |
0 |
2 |
-P -F |
1 |
2 |
-P -E |
0 |
2 |
-P -G |
0 |
2 |
-G -F -E |
0 |
2 |
-F -F |
1 |
1 |
-E -E |
0 |
0 |
When two different matcher-selection flags are given on the same command line
(
-F/--fixed-strings,-E/--extended-regexp,-G/--basic-regexp,-P/--perl-regexp), GNU grep treats it as a usage error and exits with code2and the messageconflicting matchers specified.uu_grepsilently lets thelast flag win and performs the match, exiting
0/1.Repeating the same matcher flag (e.g.
-F -F) is accepted by both and is notaffected.
Rust (incorrect - accepts the conflict)
GNU (correct)
Affected combinations
Every pairing of two different matcher types diverges (Rust accepts, GNU errors
with exit 2):
-F -G-F -E-E -G-G -E-P -F-P -E-P -G-G -F -E-F -F-E -E