Skip to content

Commit b9cc405

Browse files
avargitster
authored andcommitted
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 d2b86fb ("commit-graph: fix buffer read-overflow", 2019-01-15). 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. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/dd.html Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Helped-by: SZEDER Gábor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4abf20f commit b9cc405

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

t/t5318-commit-graph.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ corrupt_graph_and_verify() {
382382
test_when_finished mv commit-graph-backup $objdir/info/commit-graph &&
383383
cp $objdir/info/commit-graph commit-graph-backup &&
384384
printf "$data" | dd of="$objdir/info/commit-graph" bs=1 seek="$pos" conv=notrunc &&
385-
dd of="$objdir/info/commit-graph" bs=1 seek="$zero_pos" count=0 &&
385+
dd of="$objdir/info/commit-graph" bs=1 seek="$zero_pos" if=/dev/null &&
386386
generate_zero_bytes $(($orig_size - $zero_pos)) >>"$objdir/info/commit-graph" &&
387387
test_must_fail git commit-graph verify 2>test_err &&
388388
grep -v "^+" test_err >err &&

0 commit comments

Comments
 (0)