git-am: use printf instead of echo on user-supplied strings
Under some implementations of echo (such as that provided by dash), backslash escapes are recognized without any other options. This means that echo-ing user-supplied strings may cause any backslash sequences in them to be converted. Using printf resolves the ambiguity. This bug can be seen when using git-am to apply a patch whose subject contains the character sequence "\n"; the characters are converted to a literal newline. Noticed by Szekeres Istvan. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
c1bab2889e
commit
4b7cc26a74
@ -331,7 +331,7 @@ do
|
|||||||
ADD_SIGNOFF=
|
ADD_SIGNOFF=
|
||||||
fi
|
fi
|
||||||
{
|
{
|
||||||
echo "$SUBJECT"
|
printf '%s\n' "$SUBJECT"
|
||||||
if test -s "$dotest/msg-clean"
|
if test -s "$dotest/msg-clean"
|
||||||
then
|
then
|
||||||
echo
|
echo
|
||||||
@ -394,7 +394,7 @@ do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Applying '$SUBJECT'"
|
printf 'Applying %s\n' "$SUBJECT"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
case "$resolved" in
|
case "$resolved" in
|
||||||
|
Loading…
Reference in New Issue
Block a user