GNU grep supports two buffer anchors: \` matches the start of the buffer and \' matches the end (per line, in grep's line-oriented model these behave like ^/$). uu_grep does not recognise them — it treats \` and \' as the literal characters ` and ', so a pattern like t\' matches nothing instead of a line ending in t.
Found by the differential fuzzer (fuzz_grep).
Rust (incorrect)
$ printf 'cat\ndog\n' | ./target/release/grep -e "t\\'"
# Output: (none)
# Exit code: 1
GNU (correct)
$ printf 'cat\ndog\n' | LC_ALL=C /usr/bin/grep -e "t\\'"
cat
# Exit code: 0
The start-of-buffer anchor behaves the same way: \`c matches cat in GNU but nothing in uu_grep.
GNU grep supports two buffer anchors:
\`matches the start of the buffer and\'matches the end (per line, in grep's line-oriented model these behave like^/$).uu_grepdoes not recognise them — it treats\`and\'as the literal characters`and', so a pattern liket\'matches nothing instead of a line ending int.Found by the differential fuzzer (
fuzz_grep).Rust (incorrect)
GNU (correct)
The start-of-buffer anchor behaves the same way:
\`cmatchescatin GNU but nothing inuu_grep.