diff options
-rwxr-xr-x | t/check-non-portable-shell.pl | 1 | ||||
-rwxr-xr-x | t/t5310-pack-bitmaps.sh | 2 | ||||
-rw-r--r-- | t/test-lib.sh | 4 |
3 files changed, 4 insertions, 3 deletions
diff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.pl index d5823f71d8..c8f10d40a1 100755 --- a/t/check-non-portable-shell.pl +++ b/t/check-non-portable-shell.pl @@ -41,6 +41,7 @@ while (<>) { /^\s*[^#]\s*which\s/ and err 'which is not portable (use type)'; /\btest\s+[^=]*==/ and err '"test a == b" is not portable (use =)'; /\bwc -l.*"\s*=/ and err '`"$(wc -l)"` is not portable (use test_line_count)'; + /\bhead\s+-c\b/ and err 'head -c is not portable (use test_copy_bytes BYTES <file >out)'; /\bexport\s+[A-Za-z0-9_]*=/ and err '"export FOO=bar" is not portable (use FOO=bar && export FOO)'; /^\s*([A-Z0-9_]+=(\w+|(["']).*?\3)\s+)+(\w+)/ and exists($func{$4}) and err '"FOO=bar shell_func" assignment extends beyond "shell_func"'; diff --git a/t/t5310-pack-bitmaps.sh b/t/t5310-pack-bitmaps.sh index 557bd0d0c0..7bff7923f2 100755 --- a/t/t5310-pack-bitmaps.sh +++ b/t/t5310-pack-bitmaps.sh @@ -335,7 +335,7 @@ test_expect_success 'truncated bitmap fails gracefully' ' git rev-list --use-bitmap-index --count --all >expect && bitmap=$(ls .git/objects/pack/*.bitmap) && test_when_finished "rm -f $bitmap" && - head -c 512 <$bitmap >$bitmap.tmp && + test_copy_bytes 512 <$bitmap >$bitmap.tmp && mv -f $bitmap.tmp $bitmap && git rev-list --use-bitmap-index --count --all >actual 2>stderr && test_cmp expect actual && diff --git a/t/test-lib.sh b/t/test-lib.sh index 8bb0f4348e..44288cbb59 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -867,7 +867,7 @@ then # handle only executables, unless they are shell libraries that # need to be in the exec-path. test -x "$1" || - test "# " = "$(head -c 2 <"$1")" || + test "# " = "$(test_copy_bytes 2 <"$1")" || return; base=$(basename "$1") @@ -882,7 +882,7 @@ then # do not override scripts if test -x "$symlink_target" && test ! -d "$symlink_target" && - test "#!" != "$(head -c 2 < "$symlink_target")" + test "#!" != "$(test_copy_bytes 2 <"$symlink_target")" then symlink_target=../valgrind.sh fi |