-q/--quiet must write nothing to stdout. When -q is combined with -c and the input contains no match, uu_grep still prints the count 0. GNU prints nothing. (When there is a match both stay silent, because -q makes the search exit early before the count is emitted — so the divergence only shows on the no-match path.)
Found by the differential fuzzer (fuzz_grep).
Rust (incorrect)
$ printf 'foo\n' | ./target/release/grep -e 'ZZZ' -q -c
# Output: 0
# Exit code: 1
GNU (correct)
$ printf 'foo\n' | LC_ALL=C /usr/bin/grep -e 'ZZZ' -q -c
# Output: (none)
# Exit code: 1
Controls that agree: -q -c with a match prints nothing in both; -q alone (no -c) prints nothing in both.
-q/--quietmust write nothing to stdout. When-qis combined with-cand the input contains no match,uu_grepstill prints the count0. GNU prints nothing. (When there is a match both stay silent, because-qmakes the search exit early before the count is emitted — so the divergence only shows on the no-match path.)Found by the differential fuzzer (
fuzz_grep).Rust (incorrect)
GNU (correct)
Controls that agree:
-q -cwith a match prints nothing in both;-qalone (no-c) prints nothing in both.