public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: David Kastrup <dak@gnu•org>
To: Junio C Hamano <gitster@pobox•com>
Cc: Jonathan Nieder <jrnieder@gmail•com>, Uwe Storbeck <uwe@ibr•ch>,
	git@vger•kernel.org
Subject: Re: [PATCH] test-lib.sh: use printf instead of echo
Date: Wed, 19 Mar 2014 18:22:40 +0100	[thread overview]
Message-ID: <871txygl27.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <xmqqfvme5cql.fsf@gitster.dls.corp.google.com> (Junio C. Hamano's message of "Wed, 19 Mar 2014 10:17:54 -0700")

Junio C Hamano <gitster@pobox•com> writes:

> Jonathan Nieder <jrnieder@gmail•com> writes:
>
>> Junio C Hamano wrote:
>>>> Uwe Storbeck wrote:
>>
>>>>> +	printf '%s\n' "$@" | sed -e 's/^/#	/'
>>>
>>> This is wrong, isn't it?  Why do we want one line per item here?
>>
>> Yes, Hannes caught the same, too.  Sorry for the sloppiness.
>>
>> We currently use "echo" all over the place (e.g., 'echo "$path"' in
>> git-sh-setup), and every time we fix it there is a chance of making
>> mistakes.  I wonder if it would make sense to add a helper to make the
>> echo calls easier to replace:
>
> I agree that we would benefit from having a helper to print a single
> line, which we very often do, without having to worry about the
> boilerplate '%s\n' of printf or the portability gotcha of echo.
>
> I am a bit reluctant to name the helper "sane_echo" to declare "echo
> that interprets backslashes in the string is insane", though.

raw_echo

-- 
David Kastrup

  reply	other threads:[~2014-03-19 17:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-14 23:57 [PATCH] test-lib.sh: use printf instead of echo Uwe Storbeck
2014-03-15  0:18 ` Jonathan Nieder
2014-03-17 19:26   ` Junio C Hamano
2014-03-18 22:18     ` Jonathan Nieder
2014-03-19 17:17       ` Junio C Hamano
2014-03-19 17:22         ` David Kastrup [this message]
2014-03-19 19:24           ` Junio C Hamano
2014-03-20  0:17         ` Jonathan Nieder
2014-03-20 16:42           ` Junio C Hamano
2014-03-15  8:59 ` Johannes Sixt
2014-03-17 18:38   ` Uwe Storbeck
2014-03-17 18:39 ` [PATCH v2] " Uwe Storbeck
2014-03-18  0:14 ` [PATCH v3] test-lib.sh: do not "echo" externally supplied strings Uwe Storbeck
2014-03-18 18:47   ` Junio C Hamano

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=871txygl27.fsf@fencepost.gnu.org \
    --to=dak@gnu$(echo .)org \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=jrnieder@gmail$(echo .)com \
    --cc=uwe@ibr$(echo .)ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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