summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c1bab28)
raw | patch | inline | side by side (parent: c1bab28)
author | Jeff King <peff@peff.net> | |
Sat, 26 May 2007 03:42:36 +0000 (23:42 -0400) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sat, 26 May 2007 04:43:33 +0000 (21:43 -0700) |
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>
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>
git-am.sh | patch | blob | history |
diff --git a/git-am.sh b/git-am.sh
index c9f66e278454374714794477be7ff8b93cd05a0f..543efd0ad3512d09081432c4590af7575f93dd1f 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
ADD_SIGNOFF=
fi
{
- echo "$SUBJECT"
+ printf '%s\n' "$SUBJECT"
if test -s "$dotest/msg-clean"
then
echo
fi
echo
- echo "Applying '$SUBJECT'"
+ printf 'Applying %s\n' "$SUBJECT"
echo
case "$resolved" in