Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit cb1aefd

Browse files
Uwe Storbeckgitster
authored andcommitted
test-lib.sh: do not "echo" caller-supplied strings
In some places we "echo" a string that is supplied by the calling test script and may contain backslash sequences. The echo command of some shells, most notably "dash", interprets these backslash sequences (POSIX.1 allows this) which may scramble the test output. Signed-off-by: Uwe Storbeck <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 47be066 commit cb1aefd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

t/test-lib.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ error "Test script did not set test_description."
277277

278278
if test "$help" = "t"
279279
then
280-
echo "$test_description"
280+
printf '%s\n' "$test_description"
281281
exit 0
282282
fi
283283

@@ -328,7 +328,7 @@ test_failure_ () {
328328
test_failure=$(($test_failure + 1))
329329
say_color error "not ok $test_count - $1"
330330
shift
331-
echo "$@" | sed -e 's/^/# /'
331+
printf '%s\n' "$*" | sed -e 's/^/# /'
332332
test "$immediate" = "" || { GIT_EXIT_OK=t; exit 1; }
333333
}
334334

0 commit comments

Comments
 (0)