[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bdb424b0-2d11-4f6d-994d-b2b959098faf@gmail.com>
Date: Wed, 27 Dec 2023 22:53:54 -0500
From: Eli Schwartz <eschwartz93@...il.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH iproute2 2/2] configure: use the portable printf to
suppress newlines in messages
On 12/27/23 7:46 PM, Stephen Hemminger wrote:
> On Sun, 17 Dec 2023 22:30:53 -0500
> Eli Schwartz <eschwartz93@...il.com> wrote:
>
>> Per https://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html
>> the "echo" utility is un-recommended and its behavior is non-portable
>> and unpredictable. It *should* be marked as obsolescent, but was not,
>> due solely "because of its extremely widespread use in historical
>> applications".
>>
>> POSIX doesn't require the -n option, and although its behavior is
>> reliable in `#!/bin/bash` scripts, this configure script uses
>> `#!/bin/sh` and cannot rely on echo -n.
>>
>> The use of printf even without newline suppression or backslash
>> character sequences is nicer for consistency, since there are a variety
>> of ways it can go wrong with echo including "echoing the value of a
>> shell or environment variable".
>>
>> See:
>> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html
>> https://cfajohnson.com/shell/cus-faq.html#Q0b
>> ---
>
> This is needless churn, it works now, and bash is never going
> to remove the echo command. The script only has to work on Linux.
I think you've misunderstood something. It does not work now, because of
the reason stated in the patch message.
Whether bash does or does not remove the echo command is irrelevant.
Bash is NOT the only linux /bin/sh shell, and "it only has to work on
Linux" is NOT a valid reason to write code that is designed to work with
/bin/bash, but uses a shebang of /bin/sh.
Would you prefer to change the shebang to #!/bin/bash instead?
> Plus, the patch is missing signed-off-by.
I'm more than happy to send in an updated patch. :)
--
Eli Schwartz
Powered by blists - more mailing lists