Skip to content

Commit

Permalink
t4012: Fix invalid call to dd(1)
Browse files Browse the repository at this point in the history
t4012 assumed that it is okay to seek beyond the end of stdin. It is not,
and leads to an access violation (Windows speak for: segmentation fault)
with MinGW's dd.exe iff run in non-verbose mode.

Further, for some reason 'echo X | dd bs=1k seek=1' resulted in 2050 bytes
in this developer's setup instead of 1026.

So let's use a valid technique to generate 1024 NULs followed by X and a
line feed: a good ole' Perl script.

This patch is dedicated to Randal "Merlyn" Schwartz.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed May 20, 2012
1 parent 6bb8d90 commit fce52b4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion t/t4012-diff-binary.sh
Expand Up @@ -113,7 +113,7 @@ cat >expect <<EOF
EOF

test_expect_success 'diff --stat with binary files and big change count' '
echo X | dd of=binfile bs=1k seek=1 &&
perl -e "print \"\\0\" x 1024; print \"X\\n\";" > binfile &&
git add binfile &&
i=0 &&
while test $i -lt 10000; do
Expand Down

0 comments on commit fce52b4

Please sign in to comment.