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
wrong exit code for -o -v with a zero-width match on an empty line (related to #18) #28
When -o (only-matching) and -v (invert) are combined with a pattern whose only match on some line is zero-width (e.g. $, x*), and that line is empty, uu_grep treats the empty line as not matching. -v then selects it, so uu_grep reports a selection and exits 0. GNU matches the zero-width pattern on the empty line (so -v does not select it) and exits 1.
Found by the differential fuzzer (fuzz_grep). This shares its root with #18 (zero-length matches are dropped before they can mark a line as matched), but manifests through the -o/-v path and the exit code rather than -w/-x.
Input is a, an empty line, b — the pattern $ matches the end of all three lines.
Same with x* instead of $. Controls that agree: without -o (grep '$' -v) both exit 1; without the empty line (printf 'a\nb\n') both exit 1; a plain count grep '$' -c is 3 in both (so the empty line does match in plain mode — only the -o path mishandles it).
Activity