summaryrefslogtreecommitdiff
path: root/t/t5318-commit-graph.sh
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2019-02-21 19:28:49 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-02-22 19:20:56 (GMT)
commitb9cc405612f6badded21cb526cdeaa627fecbb37 (patch)
treec273daae27bd0fedd5a31f7c067d28c69cc7884e /t/t5318-commit-graph.sh
parent4abf20f00439b857c34bac55176011c5612310da (diff)
downloadgit-b9cc405612f6badded21cb526cdeaa627fecbb37.zip
git-b9cc405612f6badded21cb526cdeaa627fecbb37.tar.gz
git-b9cc405612f6badded21cb526cdeaa627fecbb37.tar.bz2
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 d2b86fbaa1 ("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 <avarab@gmail.com> Helped-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5318-commit-graph.sh')
-rwxr-xr-xt/t5318-commit-graph.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh
index d4bd152..561796f 100755
--- a/t/t5318-commit-graph.sh
+++ b/t/t5318-commit-graph.sh
@@ -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 &&