From: Junio C Hamano <gitster@pobox•com>
To: David Kastrup <dak@gnu•org>
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 12:24:55 -0700 [thread overview]
Message-ID: <xmqqob122dq0.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <871txygl27.fsf@fencepost.gnu.org> (David Kastrup's message of "Wed, 19 Mar 2014 18:22:40 +0100")
David Kastrup <dak@gnu•org> writes:
> 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
Yeah, but the thing is, this is not even "raw" if you view it from
the direction of knowing what "echo" does. That is why I repeated
"helper to print a single line", which is a viewpoint from the user
side. "We do not care how it is implemented, we just want a single
line printed" is what we want to express, which "say" is perfectly
in line with. "We use a subset semantics of 'echo' to implement it"
is of secondary concern.
next prev parent reply other threads:[~2014-03-19 19:25 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
2014-03-19 19:24 ` Junio C Hamano [this message]
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=xmqqob122dq0.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=dak@gnu$(echo .)org \
--cc=git@vger$(echo .)kernel.org \
--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