git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Michael J Gruber <git@drmicha.warpmail.net>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: POSIX woes in t7810.87: dash bash or bash dash?
Date: Mon, 20 Jun 2011 13:13:07 -0400	[thread overview]
Message-ID: <20110620171307.GA5859@sigill.intra.peff.net> (raw)
In-Reply-To: <20110620110440.GA29270@elie>

On Mon, Jun 20, 2011 at 06:04:41AM -0500, Jonathan Nieder wrote:

> Michael J Gruber wrote:
> 
> > echo "a\"b\n\"c"
> > a"b
> > "c
> >
> > t7810.87 breaks with dash because of this. Escaping the \n does not make
> > the test work with both either.
> 
> This seems to have slipped by because testing it requires USE_LIBPCRE
> to be set.  Thanks for catching it.

Yeah, I test with dash, too, and missed it because I hadn't enabled
pcre.

> > So I'd like to know which one's right
> > and (independently) how to make it work for both...
> 
> Both are right.  The simplest fix is to use printf, as in
> 
> 	printf "%s\n" "a\"b\n\"c"
> 
> See [1] and [2].

Yep. We've dealt with this before and used printf as the solution. E.g.:

  938791c (git-rebase--interactive.sh: use printf instead of echo to print commit message, 2010-07-22)
  4d2e283 (git-am: re-fix the diag message printing, 2009-01-18)
  a23bfae (More echo "$user_message" fixes., 2007-05-26)
  4b7cc26 (git-am: use printf instead of echo on user-supplied strings, 2007-05-25)

-Peff

  reply	other threads:[~2011-06-20 17:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-20  9:58 POSIX woes in t7810.87: dash bash or bash dash? Michael J Gruber
2011-06-20 11:04 ` Jonathan Nieder
2011-06-20 17:13   ` Jeff King [this message]
2011-06-20 21:46 ` Junio C Hamano
2011-06-20 23:24   ` Jeff King
2011-06-20 23:31     ` Junio C Hamano
2011-06-21  0:21       ` Jeff King

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=20110620171307.GA5859@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    /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).