From: Jeff King <peff@peff.net>
To: Uwe Storbeck <uwe@ibr.ch>
Cc: git@vger.kernel.org
Subject: Re: Corner case bug caused by shell dependent behavior
Date: Thu, 13 Mar 2014 22:28:46 -0400 [thread overview]
Message-ID: <20140314022845.GA19757@sigill.intra.peff.net> (raw)
In-Reply-To: <20140314000213.GA3739@ibr.ch>
On Fri, Mar 14, 2014 at 01:02:13AM +0100, Uwe Storbeck wrote:
> When your system shell (/bin/sh) is a dash control sequences in
> strings get interpreted by the echo command. A commit message
> which ends with the string '\n' may result in a garbage line in
> the todo list of an interactive rebase which causes the rebase
> to fail.
>
> To reproduce the behavior (with dash as /bin/sh):
>
> mkdir test && cd test && git init
> echo 1 >foo && git add foo
> git commit -m"this commit message ends with '\n'"
> echo 2 >foo && git commit -a --fixup HEAD
> git rebase -i --autosquash --root
Hmph. We ran into this before and fixed all of the sites (e.g., d1c3b10
and 938791c). This one appears to have been added a few months later
(by 68d5d03).
> Maybe there are more places where it would be more robust to use
> printf instead of echo.
FWIW, I just looked through the other uses of "echo" in git-rebase*.sh,
and I think this is the only problematic case.
> - echo "$sha1 $action $prefix $rest"
> + printf "%s %s %s %s\n" "$sha1" "$action" "$prefix" "$rest"
Looks obviously correct. The echo just below here does not need the same
treatment, as "$rest" is the problematic bit ("$prefix" is always
"fixup" or "squash").
-Peff
next prev parent reply other threads:[~2014-03-14 2:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-14 0:02 Corner case bug caused by shell dependent behavior Uwe Storbeck
2014-03-14 0:37 ` Jonathan Nieder
2014-03-14 23:53 ` Uwe Storbeck
2014-03-14 2:28 ` Jeff King [this message]
2014-03-14 6:08 ` David Kastrup
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140314022845.GA19757@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=uwe@ibr.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).