summaryrefslogtreecommitdiff
path: root/git-am.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2007-05-26 03:42:36 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-05-26 04:43:33 (GMT)
commit4b7cc26a74b01ceab14a32ef66704557b26d5622 (patch)
tree2719dd1ecc701a0979f440d6b1e9f26e6c590fb4 /git-am.sh
parentc1bab2889eb71bf537497fc77a2fdb6a74bc92e6 (diff)
downloadgit-4b7cc26a74b01ceab14a32ef66704557b26d5622.zip
git-4b7cc26a74b01ceab14a32ef66704557b26d5622.tar.gz
git-4b7cc26a74b01ceab14a32ef66704557b26d5622.tar.bz2
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>
Diffstat (limited to 'git-am.sh')
-rwxr-xr-xgit-am.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/git-am.sh b/git-am.sh
index c9f66e2..543efd0 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -331,7 +331,7 @@ do
ADD_SIGNOFF=
fi
{
- echo "$SUBJECT"
+ printf '%s\n' "$SUBJECT"
if test -s "$dotest/msg-clean"
then
echo
@@ -394,7 +394,7 @@ do
fi
echo
- echo "Applying '$SUBJECT'"
+ printf 'Applying %s\n' "$SUBJECT"
echo
case "$resolved" in