Commit b9cc4056 authored by Ævar Arnfjörð Bjarmason's avatar Ævar Arnfjörð Bjarmason Committed by Junio C Hamano

commit-graph tests: fix unportable "dd" invocation

Change an unportable invocation of "dd" with count=0, that wanted to
truncate the commit-graph file.  In POSIX it is unspecified what
happens when count=0 is provided[1]. The NetBSD "dd" behavior
differs from GNU (and seemingly other BSDs), which has left this test
broken since d2b86fba ("commit-graph: fix buffer read-overflow",

Copying from /dev/null would seek/truncate to seek=$zero_pos and
stop immediately after that (without being able to copy anything),
which is the right way to truncate the file.

1. Ævar Arnfjörð Bjarmason's avatarÆvar Arnfjörð Bjarmason <>
Helped-by: Gábor Szeder's avatarSZEDER Gábor <>
Signed-off-by: default avatarJunio C Hamano <>
parent 4abf20f0
......@@ -382,7 +382,7 @@ corrupt_graph_and_verify() {
test_when_finished mv commit-graph-backup $objdir/info/commit-graph &&
cp $objdir/info/commit-graph commit-graph-backup &&
printf "$data" | dd of="$objdir/info/commit-graph" bs=1 seek="$pos" conv=notrunc &&
dd of="$objdir/info/commit-graph" bs=1 seek="$zero_pos" count=0 &&
dd of="$objdir/info/commit-graph" bs=1 seek="$zero_pos" if=/dev/null &&
generate_zero_bytes $(($orig_size - $zero_pos)) >>"$objdir/info/commit-graph" &&
test_must_fail git commit-graph verify 2>test_err &&
grep -v "^+" test_err >err &&
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment