All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Thomas Adam <thomas.adam22@gmail.com>
Cc: Stephen Boyd <bebarino@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCHv2 1/3] git-sh-setup: introduce say() for quiet options
Date: Sun, 14 Jun 2009 21:23:08 -0700	[thread overview]
Message-ID: <7vab4ap1lf.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <18071eea0906141621t676a965aqc3056b481b8e8796@mail.gmail.com> (Thomas Adam's message of "Mon\, 15 Jun 2009 00\:21\:53 +0100")

Thomas Adam <thomas.adam22@gmail.com> writes:

> 2009/6/15 Stephen Boyd <bebarino@gmail.com>:
>> Scripts should use say() when they want to echo to stdout. Setting
>> GIT_QUIET will mute say(), allowing scripts to easily implement a quiet
>> option.
>>
>> Signed-off-by: Stephen Boyd <bebarino@gmail.com>
>> ---
>>  git-sh-setup.sh |    7 +++++++
>>  1 files changed, 7 insertions(+), 0 deletions(-)
>>
>> diff --git a/git-sh-setup.sh b/git-sh-setup.sh
>> index 80acb7d..f88184e 100755
>> --- a/git-sh-setup.sh
>> +++ b/git-sh-setup.sh
>> @@ -44,6 +44,13 @@ die() {
>>        exit 1
>>  }
>>
>> +say () {
>> +       if test -z "$GIT_QUIET"
>> +       then
>> +               echo "$@"
>
> Except that where you've then replaced various calls with say() they
> were originally using printf.

The only difference I found in these three patch series is this hunk  on
git-am.sh in [PATCHv2 3/3]:

    @@ -498,7 +505,7 @@ do
                    stop_here $this
            fi

    -       printf 'Applying: %s\n' "$FIRSTLINE"
    +       say "Applying: $FIRSTLINE"

            case "$resolved" in
            '')

This was made from echo to printf with 4b7cc26 (git-am: use printf instead
of echo on user-supplied strings, 2007-05-25), with reason:

    Under some implementations of echo (such as that provided by
    dash), backslash escapes are recognized without any other
    options. This means that echo-ing user-supplied strings may
    cause any backslash sequences in them to be converted. Using
    printf resolves the ambiguity.
    
    This bug can be seen when using git-am to apply a patch
    whose subject contains the character sequence "\n"; the
    characters are converted to a literal newline. Noticed by
    Szekeres Istvan.

To make the conversion of the above hunk correct, say() must use

	printf "%s" "$*"

Needless to say, all the conversions from "echo" to "say" in the patch
series need to be verified.

  reply	other threads:[~2009-06-15  4:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-13 20:21 [PATCH 0/2] teach am and rebase -q/--quiet Stephen Boyd
2009-06-13 20:21 ` [PATCH 1/2] am: teach quiet option Stephen Boyd
2009-06-13 20:21   ` [PATCH 2/2] rebase: " Stephen Boyd
2009-06-13 23:05 ` [PATCH 0/2] teach am and rebase -q/--quiet Junio C Hamano
2009-06-14  7:07   ` Stephen Boyd
2009-06-14  8:27   ` Sverre Rabbelier
2009-06-13 23:07 ` Junio C Hamano
2009-06-14  7:16   ` Stephen Boyd
2009-06-14  8:24     ` Junio C Hamano
2009-06-14 23:16 ` [PATCHv2 0/3] Teach shell scripts to be quiet Stephen Boyd
2009-06-14 23:16   ` [PATCHv2 1/3] git-sh-setup: introduce say() for quiet options Stephen Boyd
2009-06-14 23:16     ` [PATCHv2 2/3] submodule, repack: migrate to git-sh-setup's say() Stephen Boyd
2009-06-14 23:16       ` [PATCHv2 3/3] am, rebase: teach quiet option Stephen Boyd
2009-06-14 23:21     ` [PATCHv2 1/3] git-sh-setup: introduce say() for quiet options Thomas Adam
2009-06-15  4:23       ` Junio C Hamano [this message]
2009-06-15  6:15         ` Stephen Boyd
2009-06-15  6:25     ` Johannes Sixt
2009-06-15  6:33       ` Stephen Boyd

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=7vab4ap1lf.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=bebarino@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=thomas.adam22@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.