From: David Kastrup <dak@gnu.org>
To: Jeff King <peff@peff.net>
Cc: Uwe Storbeck <uwe@ibr.ch>, git@vger.kernel.org
Subject: Re: Corner case bug caused by shell dependent behavior
Date: Fri, 14 Mar 2014 07:08:36 +0100 [thread overview]
Message-ID: <87d2hpgvmj.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <20140314022845.GA19757@sigill.intra.peff.net> (Jeff King's message of "Thu, 13 Mar 2014 22:28:46 -0400")
Jeff King <peff@peff.net> writes:
> 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").
I'd not rationalize this away by deep analysis. Copy&paste is a thing,
so to just use printf whenever _any_ seriously variable strings (source
not immediately the shell script itself, perhaps even _any_ nonconstant
strings) are involved keeps people from introducing bugs by following
apparent practice.
--
David Kastrup
prev parent reply other threads:[~2014-03-14 6:09 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
2014-03-14 6:08 ` David Kastrup [this message]
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=87d2hpgvmj.fsf@fencepost.gnu.org \
--to=dak@gnu.org \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--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).