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
emits a spurious -- context separator between adjacent groups #24
With before-context (-B/-C), uu_grep prints a -- group separator between two output groups even when they are adjacent — i.e. the next group's context begins on the line immediately after the last line already printed. GNU only prints -- when there is a real gap (one or more skipped lines) between groups.
Found by the differential fuzzer (fuzz_grep).
Input is five lines: a, b, empty, empty, c. Pattern . matches the three non-empty lines.
Rust (incorrect)
$ printf'a\nb\n\n\nc\n'| ./target/release/grep -e '.' -B 2
a
b
--
c
# Exit code: 0
GNU (correct)
$ printf'a\nb\n\n\nc\n'| LC_ALL=C /usr/bin/grep -e '.' -B 2
a
b
c
# Exit code: 0
The first group ends at line 2 (b). The match on line 5 (c) pulls in before-context lines 3 and 4, so the second group starts at line 3 — immediately after line 2. The groups touch, so no separator belongs there: GNU merges them, uu_grep inserts --.
Activity