git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Telka <marcel@telka.sk>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH] t/t9902-completion.sh: backslashes in echo
Date: Thu, 23 May 2024 23:47:12 +0200	[thread overview]
Message-ID: <Zk-5YCKSO32vPKDP@telcontar> (raw)
In-Reply-To: <CAPig+cRddr=JTVvkh5xkptag_1C5-z1t9Pzr_OdcGFSVwRg3vg@mail.gmail.com>

On Thu, May 23, 2024 at 05:06:00PM -0400, Eric Sunshine wrote:
> On Thu, May 23, 2024 at 4:32 PM Marcel Telka <marcel@telka.sk> wrote:
> > On Thu, May 23, 2024 at 10:59:13AM -0700, Junio C Hamano wrote:
> > > Marcel Telka <marcel@telka.sk> writes:
> > > > The usage of backslashes in echo is not portable.  Since some tests
> > > > tries to output strings containing '\b' it is safer to use printf
> > > > here.  The usage of printf instead of echo is also preferred by POSIX.
> > >
> > > This has cooked in 'next' for some time already, and I'll merge this
> > > down to 'master' anyway, but this being a script very much speicific
> > > to bash whose built-in echo we are using, the portability argument
> > > of "echo" made in the proposed log message does not quite apply to
> > > this patch.
> >
> > Could you please help me to understand how the bash is used to run the
> > script?
> >
> > $ head -n 1 t/t9902-completion.sh
> > #!/bin/sh
> 
> Looking a bit farther in t9902, you'll find:
> 
>     . ./lib-bash.sh
> 
> And if you look inside `lib-bash.sh`, you'll see that, if the
> currently-running shell is not Bash, it aborts the current script and
> re-runs it under Bash.

Thanks for the pointer!

Interesting.  I came to this issue because the test failed here due to
the echo.  So apparently the re-run under bash didn't happen here for
some reason or bash's echo behaved differently?  I need to dig into it
again to find what's going on.

> But Junio's point was that t9902 is dedicated to testing Bash-specific
> functionality, so the commit message's justification to avoid this
> non-POSIX behavior isn't necessarily a good justification for the
> change. (He wasn't saying that the change itself was unwelcome, just
> that the commit message wasn't convincing.)

Sure.  I understand the point.  I just had an impression that the test
is running under POSIX sh (/bin/sh), not bash, because it failed here
(see above).

OTOH, it seems that the fix is maybe not needed because it is solving a
non-problem.


Thank you.

-- 
+-------------------------------------------+
| Marcel Telka   e-mail:   marcel@telka.sk  |
|                homepage: http://telka.sk/ |
+-------------------------------------------+

  reply	other threads:[~2024-05-23 21:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-17 14:08 [PATCH] t/t9902-completion.sh: backslashes in echo Marcel Telka
2024-05-23 17:59 ` Junio C Hamano
2024-05-23 20:31   ` Marcel Telka
2024-05-23 21:06     ` Eric Sunshine
2024-05-23 21:47       ` Marcel Telka [this message]
2024-05-23 22:39         ` Marcel Telka
2024-05-23 22:45           ` Marcel Telka
2024-05-23 23:03           ` Junio C Hamano
2024-05-23 23:14             ` Eric Sunshine
2024-05-23 23:21             ` Marcel Telka

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=Zk-5YCKSO32vPKDP@telcontar \
    --to=marcel@telka.sk \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sunshine@sunshineco.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).