netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Eli Schwartz <eschwartz93@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 2/2] configure: use the portable printf to suppress newlines in messages
Date: Mon, 1 Jan 2024 11:03:48 -0800	[thread overview]
Message-ID: <20240101110348.482a679d@hermes.local> (raw)
In-Reply-To: <20231229060013.2375774-2-eschwartz93@gmail.com>

On Fri, 29 Dec 2023 01:00:10 -0500
Eli Schwartz <eschwartz93@gmail.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
> See: https://cfajohnson.com/shell/cus-faq.html#Q0b
> Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>

This part is not necessary. Although echo is not portable, it is used
many places and not worth changing.

  reply	other threads:[~2024-01-01 19:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-18  3:30 [PATCH iproute2 1/2] configure: avoid un-recommended command substitution form Eli Schwartz
2023-12-18  3:30 ` [PATCH iproute2 2/2] configure: use the portable printf to suppress newlines in messages Eli Schwartz
2023-12-28  0:46   ` Stephen Hemminger
2023-12-28  3:53     ` Eli Schwartz
2023-12-29  6:00     ` [PATCH 1/2] configure: avoid un-recommended command substitution form Eli Schwartz
2023-12-29  6:00       ` [PATCH 2/2] configure: use the portable printf to suppress newlines in messages Eli Schwartz
2024-01-01 19:03         ` Stephen Hemminger [this message]
2023-12-28  0:46 ` [PATCH iproute2 1/2] configure: avoid un-recommended command substitution form Stephen Hemminger
2023-12-28  3:57   ` Eli Schwartz
2023-12-29 19:36     ` Stephen Hemminger
2023-12-30  0:42       ` David Ahern

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=20240101110348.482a679d@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=eschwartz93@gmail.com \
    --cc=netdev@vger.kernel.org \
    /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).