-l (--files-with-matches) and -L (--files-without-match) are opposites. GNU treats them as mutually exclusive with last-one-wins semantics. uu_grep keeps both flags independently active and always lets -l win, so -l -L (with -l first) diverges.
Found by the differential fuzzer (fuzz_grep).
Rust (incorrect)
$ printf 'match5here\n' > /tmp/p.txt
$ ./target/release/grep -e 5 -l -L /tmp/p.txt
/tmp/p.txt
# Exit code: 0
GNU (correct)
$ printf 'match5here\n' > /tmp/p.txt
$ LC_ALL=C /usr/bin/grep -e 5 -l -L /tmp/p.txt
# Output: (none — last flag is -L, and the file *does* match, so it is not listed)
# Exit code: 0
With the order reversed (-L -l, last flag -l) both print the filename, confirming GNU's last-wins rule. uu_grep prints the filename in both orders.
-l(--files-with-matches) and-L(--files-without-match) are opposites. GNU treats them as mutually exclusive with last-one-wins semantics.uu_grepkeeps both flags independently active and always lets-lwin, so-l -L(with-lfirst) diverges.Found by the differential fuzzer (
fuzz_grep).Rust (incorrect)
GNU (correct)
With the order reversed (
-L -l, last flag-l) both print the filename, confirming GNU's last-wins rule.uu_grepprints the filename in both orders.