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
does not short-circuit an empty pattern with -v like GNU (same family as #4) #27
An empty pattern matches every line, so combined with -v (invert) it can never select a line. GNU recognises this and short-circuits the whole run: it produces no output (so -c prints nothing, not 0) and never opens the input file, exiting 1. uu_grep runs normally — it prints the count 0, and reports an error / exits 2 for a missing file.
Found by the differential fuzzer (fuzz_grep). This is the same family as the -m 0 short-circuit (#4) but with a different trigger.
The short-circuit also skips opening files entirely — on a missing file GNU stays silent and exits 1, while uu_grep reports the open error and exits 2:
$ ./target/release/grep -e '' -v -c /nonexistent # grep: /nonexistent: No such file or directory (exit 2)
$ LC_ALL=C /usr/bin/grep -e '' -v -c /nonexistent # (no output, exit 1)
Controls that agree: grep -e '' -c (no -v) prints the line count in both; a normal zero-count case grep zzz -c prints 0 in both. The divergence is specific to the empty-pattern + -v combination, where the result set is provably empty.
Activity