Re: [PATCH] t/t9902-completion.sh: backslashes in echo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 23, 2024 at 4:32 PM Marcel Telka <marcel@xxxxxxxx> wrote:
> On Thu, May 23, 2024 at 10:59:13AM -0700, Junio C Hamano wrote:
> > Marcel Telka <marcel@xxxxxxxx> 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.

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.)





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux