From unknown Fri Aug 15 14:45:47 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#51311 <51311@debbugs.gnu.org> To: bug#51311 <51311@debbugs.gnu.org> Subject: Status: [PATCH] echo: update --help to document edge cases Reply-To: bug#51311 <51311@debbugs.gnu.org> Date: Fri, 15 Aug 2025 21:45:47 +0000 retitle 51311 [PATCH] echo: update --help to document edge cases reassign 51311 coreutils submitter 51311 Florent Flament severity 51311 normal tag 51311 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 20 22:13:41 2021 Received: (at submit) by debbugs.gnu.org; 21 Oct 2021 02:13:41 +0000 Received: from localhost ([127.0.0.1]:55791 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdNaO-0004fL-Dg for submit@debbugs.gnu.org; Wed, 20 Oct 2021 22:13:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:57956) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdJU4-0004RI-DM for submit@debbugs.gnu.org; Wed, 20 Oct 2021 17:50:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35782) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdJU4-0001MF-4B for bug-coreutils@gnu.org; Wed, 20 Oct 2021 17:50:52 -0400 Received: from smtp1-g21.free.fr ([2a01:e0c:1:1599::10]:26514) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdJU1-0002jN-Vx for bug-coreutils@gnu.org; Wed, 20 Oct 2021 17:50:51 -0400 Received: from monster (unknown [82.65.85.131]) by smtp1-g21.free.fr (Postfix) with ESMTPS id 37B1DB0029D; Wed, 20 Oct 2021 23:50:47 +0200 (CEST) From: Florent Flament To: bug-coreutils@gnu.org Subject: [PATCH] echo: update --help to document edge cases Date: Wed, 20 Oct 2021 23:50:47 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Received-SPF: softfail client-ip=2a01:e0c:1:1599::10; envelope-from=contact@florentflament.com; helo=smtp1-g21.free.fr X-Spam_score_int: 2 X-Spam_score: 0.2 X-Spam_bar: / X-Spam_report: (0.2 / 5.0 requ) BAYES_05=-0.5, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 20 Oct 2021 22:13:39 -0400 Cc: bob@proulx.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) * src/echo.c (usage): Document edge cases when displaying arbitrary strings with the echo command. --- src/echo.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/echo.c b/src/echo.c index 18513398a..73b44660b 100644 --- a/src/echo.c +++ b/src/echo.c @@ -78,6 +78,14 @@ If -e is in effect, the following sequences are recognized:\n\ fputs (_("\ \\0NNN byte with octal value NNN (1 to 3 digits)\n\ \\xHH byte with hexadecimal value HH (1 to 2 digits)\n\ +"), stdout); + fputs (_("\ +\n\ +NOTE: The echo command doesn't behave gracefully when displaying\n\ +arbitrary strings. For example, it can't display the string \"-n\" and\n\ +requires the STRICTLY_POSIX flag to display \"-e\" or \"-E\". Therefore,\n\ +if you need to display arbitrary strings please use the printf command\n\ +instead.\n\ "), stdout); printf (USAGE_BUILTIN_WARNING, PROGRAM_NAME); emit_ancillary_info (PROGRAM_NAME); -- 2.25.1 From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 21 08:11:37 2021 Received: (at 51311-done) by debbugs.gnu.org; 21 Oct 2021 12:11:37 +0000 Received: from localhost ([127.0.0.1]:56357 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdWv3-0004NL-H1 for submit@debbugs.gnu.org; Thu, 21 Oct 2021 08:11:37 -0400 Received: from mail-wm1-f47.google.com ([209.85.128.47]:55288) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdWuz-0004N2-0v for 51311-done@debbugs.gnu.org; Thu, 21 Oct 2021 08:11:36 -0400 Received: by mail-wm1-f47.google.com with SMTP id g141so430714wmg.4 for <51311-done@debbugs.gnu.org>; Thu, 21 Oct 2021 05:11:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=6RXMO81EgYwtg3p4BjbmlqAmrFLThk0OwnonGI+2rpA=; b=EiCLKOQFeWMHReVHghZPvwu3pkLL0VUJyNv2xzqeqE7bCuISLWdXhr3iDTEYNvrvYH Qx2x4XgsZ9PsIXwdkhZS2/sUf4CW6YaluDRF6/Ld/kHgzSIL4sMRSySQq9qYiqfE8AlP LNpN6Ro1XWq/02aU2CopQKD/8ypar0WiMAGmGdVVXMf8vRCLayA22++27I7NKJtB+OTV f1Z8LozRhXmJdsCq2JKMiCpl8UPIgRYJCo+iOy+dtG5OFBmYnoVmrd2BGwzsBjgLSK6U q/c7DCGXk7t7PiwsMJnOWxi/GR13lxdflmurCD37AYbfkojp+7TwfqnoDRw5/WAu/S7+ jMzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language; bh=6RXMO81EgYwtg3p4BjbmlqAmrFLThk0OwnonGI+2rpA=; b=VwJHOqDXtczJY5zhricHUalkn+Ou0v6lGMOPXehnl+BHe+GPNTeyLMxOhdynyXiyp9 wqgQIT4xZdng0k/HsOZmav5BLHsDL0hQ48hrTnXxhD+P8ztX0Tp/YQNsyMYL01imVpsf pEWcTJmG+VbrViFhxwXI+KMa5u/XybMzz5x7tYor0UumJyU6XS21T2D8ah89ee1Mw6cj kVfgQadR8LHIq7+dzgVsTyuVqc3LY3eu/IWyNkDDYmv/KSzG/hzMa/d5X9vA6I7VJQdo 9eNPFelV+J5J6TyMyQuxXw3+esvCMIri4dqoT40JyACUcT9yd1UH7SHdGDsO2rIg5cEC fGNA== X-Gm-Message-State: AOAM530ihdfzTMcKvspAOoZXje8mGfu65mhk1HHj1/KtdM2+vB3Pvm8O Kc1zkWv0p7VyGCAc8MqJ95I= X-Google-Smtp-Source: ABdhPJy3dgs1KchUpG3m1+wIofQ6t2FJ+9fVYs9+9i5uJ90FTtXxMOqmYeoKpb/3oooBIGLRM7XXQw== X-Received: by 2002:a1c:4c19:: with SMTP id z25mr6136309wmf.4.1634818287050; Thu, 21 Oct 2021 05:11:27 -0700 (PDT) Received: from localhost.localdomain (86-40-129-104-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.40.129.104]) by smtp.googlemail.com with UTF8SMTPSA id u5sm4599382wmm.39.2021.10.21.05.11.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Oct 2021 05:11:26 -0700 (PDT) Subject: Re: bug#51311: [PATCH] echo: update --help to document edge cases To: Florent Flament , 51311-done@debbugs.gnu.org References: From: =?UTF-8?Q?P=c3=a1draig_Brady?= Message-ID: Date: Thu, 21 Oct 2021 13:11:25 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------97F397B98E78746EBF46D768" Content-Language: en-US X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 51311-done Cc: bob@proulx.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) This is a multi-part message in MIME format. --------------97F397B98E78746EBF46D768 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 20/10/2021 22:50, Florent Flament wrote: > > * src/echo.c (usage): Document edge cases when displaying arbitrary > strings with the echo command. > --- > src/echo.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/src/echo.c b/src/echo.c > index 18513398a..73b44660b 100644 > --- a/src/echo.c > +++ b/src/echo.c > @@ -78,6 +78,14 @@ If -e is in effect, the following sequences are recognized:\n\ > fputs (_("\ > \\0NNN byte with octal value NNN (1 to 3 digits)\n\ > \\xHH byte with hexadecimal value HH (1 to 2 digits)\n\ > +"), stdout); > + fputs (_("\ > +\n\ > +NOTE: The echo command doesn't behave gracefully when displaying\n\ > +arbitrary strings. For example, it can't display the string \"-n\" and\n\ > +requires the STRICTLY_POSIX flag to display \"-e\" or \"-E\". Therefore,\n\ > +if you need to display arbitrary strings please use the printf command\n\ > +instead.\n\ > "), stdout); > printf (USAGE_BUILTIN_WARNING, PROGRAM_NAME); > emit_ancillary_info (PROGRAM_NAME); This is too verbose. BTW the env var is POSIXLY_CORRECT, not STRICTLY_POSIX. Anyway I don't think we should mention that in the man page anyway. I'll push the attached later, which just says printf(1) is preferred. cheers, Pádraig --------------97F397B98E78746EBF46D768 Content-Type: text/x-patch; charset=UTF-8; name="echo-printf.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="echo-printf.patch" >From 0aaa7e4ad33f9cf89d525bda0f9bfe3f9b092288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Thu, 21 Oct 2021 13:05:47 +0100 Subject: [PATCH] doc: say that printf(1) is preferred over echo(1) * src/echo.c (usage): Say printf(1) is preferred due to being more standard. * man/echo.x [SEE ALSO]: Reference printf(1). --- man/echo.x | 2 ++ src/echo.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/man/echo.x b/man/echo.x index 9c4fa8131..61a36706b 100644 --- a/man/echo.x +++ b/man/echo.x @@ -2,3 +2,5 @@ echo \- display a line of text [DESCRIPTION] .\" Add any additional description here +[SEE ALSO] +printf(1) diff --git a/src/echo.c b/src/echo.c index 18513398a..d2262fa6b 100644 --- a/src/echo.c +++ b/src/echo.c @@ -80,6 +80,10 @@ If -e is in effect, the following sequences are recognized:\n\ \\xHH byte with hexadecimal value HH (1 to 2 digits)\n\ "), stdout); printf (USAGE_BUILTIN_WARNING, PROGRAM_NAME); + fputs (_("\n\ +NOTE: printf(1) is a preferred alternative, with more standard option handling.\ +\n\ +"), stdout); emit_ancillary_info (PROGRAM_NAME); exit (status); } -- 2.26.2 --------------97F397B98E78746EBF46D768-- From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 21 09:14:13 2021 Received: (at 51311-done) by debbugs.gnu.org; 21 Oct 2021 13:14:13 +0000 Received: from localhost ([127.0.0.1]:56521 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdXtd-0008Ue-0h for submit@debbugs.gnu.org; Thu, 21 Oct 2021 09:14:13 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]:21384) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdXta-0008UU-Bi for 51311-done@debbugs.gnu.org; Thu, 21 Oct 2021 09:14:11 -0400 Received: from loshnux (unknown [82.65.85.131]) by smtp1-g21.free.fr (Postfix) with ESMTPS id 7E8A5B0053B; Thu, 21 Oct 2021 15:14:08 +0200 (CEST) From: Florent Flament To: =?utf-8?Q?P=C3=A1draig?= Brady Subject: Re: bug#51311: [PATCH] echo: update --help to document edge cases In-Reply-To: (message from =?utf-8?Q?P=C3=A1draig?= Brady on Thu, 21 Oct 2021 13:11:25 +0100) Date: Thu, 21 Oct 2021 15:14:08 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 51311-done Cc: 51311-done@debbugs.gnu.org, bob@proulx.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) P=C3=A1draig Brady writes: > BTW the env var is POSIXLY_CORRECT, not STRICTLY_POSIX. Nice catch ! > Anyway I don't think we should mention that in the man page anyway. > I'll push the attached later, which just says printf(1) is preferred. I think the man page should warn users about possible bad usages of the command. Just saying that 'printf' is preferred doesn't tell why, therefore people won't use it IMHO. > + fputs (_("\n\ > +NOTE: printf(1) is a preferred alternative, with more standard option ha= ndling.\ > +\n\ > +"), stdout); I believe that it misses the point. It is still not clear that the echo command doesn't behave as one would expect for a few edge cases. Maybe something like this would be closer to what I'm trying to express: NOTE: printf(1) is a preferred alternative, which doesn't share echo's inability to handle edge cases. Regards, Florent From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 21 16:54:24 2021 Received: (at 51311-done) by debbugs.gnu.org; 21 Oct 2021 20:54:25 +0000 Received: from localhost ([127.0.0.1]:58736 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdf4y-0003DD-Jx for submit@debbugs.gnu.org; Thu, 21 Oct 2021 16:54:24 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:52683) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdf4w-0003Cx-1y for 51311-done@debbugs.gnu.org; Thu, 21 Oct 2021 16:54:22 -0400 Received: from [192.168.101.10] ([91.12.164.137]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Myevl-1mtfrA2Hdt-00yusJ; Thu, 21 Oct 2021 22:54:09 +0200 Message-ID: <77132c1d-9bf1-64c0-aec8-b83a847ca82f@bernhard-voelker.de> Date: Thu, 21 Oct 2021 22:54:08 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: bug#51311: [PATCH] echo: update --help to document edge cases Content-Language: en-US To: Florent Flament , =?UTF-8?Q?P=c3=a1draig_Brady?= References: From: Bernhard Voelker In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:SZizoADYC10Wr79ZQr18u05/XWlfBxv1x1t7eBb43QJB596kw/4 6ICu00nPis11C5tu3pUNDp+5OXFOnGdhK1uQdD9MtDWiqsQm9I5YJQVSME2OPZ8KSAmUY9a u2WAOZvg9I1LFmqvcJOIiOPEp0zjQVFxVhHyTCZoZMzD2DFK65i0cWso6nrwFjHzXhZWNTe iZdIdy4IpB6WuM06eQqoQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:k5pl0mGCSXg=:h2DmJuvvSf/eCDrfd9V8Co a+15/NuEowtWP6ZMvZybTz+jeXAi5SDZKj/QCjSB6oK9KKFXmsYtNzxm0gh+Ao1bqpzAu6UZr 0wPYqhu5C4UV3I4HeR27iD+ZpZ5Js8bYogS0Ao1F1EBebdTKjOllT5DfOVC6P/WGcl7CPmHNW 2VYqCoYbQW969p83ECaV+OKtgB8KXi/+Y05e5NlpfOm4efCGifQcySD70I/7QMbLE3fpFLXEQ sigkqrpUp+sjtPJLXjwhmHJCmYpLAB+hrhEp9uf+IKp4oTjw7l+4NCZ0O6nuCXxzgDifs4yPg GP6i7xu4guCTkNpcoNMgwafdjNS/IfaKUi7cY2zZ7jYpOIHBs4625voI5vD4AdJA8lp2MDZSw 6trb/UDCiw+au79aB+GltDw0Xg7D5B361D+648/Q/7uOPLLRh9F1S51s0tWcIuY12Hg8ScSQT LUrs60GTvjWv7kiRuFI0GgVZjEaifACpdop8o4juFgzSP0I5mcJSwsiwGh7R+C2fwRFru4gfO lejqz+u7Yh0d3pQmFyK5FaQg80LfV4xwbDAnRm8aVCxGa9jCnerJmu+axYzHOVIBOye2VuzQh cn7HoA4OfkQXFLQoQVatcrwHLm6GMl8uLV5N9awlC/DPB4fi7hDY2MPwvJ3w7Mho3UaE8Lo9v Uw4ahAfY9pypvRM8+DEmwmVES/xgM9mIvtMd3W7tEJgdxhY/p6Zh9ni0fejwTxZeMcDgGAx3G E+2G8AbSwE8GP/TC X-Spam-Score: -0.1 (/) X-Debbugs-Envelope-To: 51311-done Cc: 51311-done@debbugs.gnu.org, bob@proulx.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.1 (-) On 10/21/21 15:14, Florent Flament wrote: > Pádraig Brady writes: >> +NOTE: printf(1) is a preferred alternative, with more standard option handling.\ > I believe that it misses the point. It is still not clear that the echo > command doesn't behave as one would expect for a few edge cases. > > Maybe something like this would be closer to what I'm trying to express: > > NOTE: printf(1) is a preferred alternative, which doesn't share echo's > inability to handle edge cases. I'm not sure that just mentioning "edge cases" will remind people either that they are falling into such particular edge case. Therefore, I'd prefer Padraig's shorter sentence: it expresses the matter positively while the latter proposal tries to explain via negative wording. If we want to be more explicit, then we'd have to name examples where printf(1) is superior to echo(1) - or the shell's echo builtin. But IMO the whole point is two-fold: if someone doesn't have enough experience to understand the edge cases, then eventually the usage of printf with the often complex format specifiers is also too much. Finally, I think Padraig's suggestion had the best tradeoff between pointing out the matter and getting too much into details. Have a nice day, Berny From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 22 03:51:23 2021 Received: (at 51311-done) by debbugs.gnu.org; 22 Oct 2021 07:51:23 +0000 Received: from localhost ([127.0.0.1]:59228 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdpKl-0006QJ-4t for submit@debbugs.gnu.org; Fri, 22 Oct 2021 03:51:23 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]:63600) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdpKi-0006Q8-Ig for 51311-done@debbugs.gnu.org; Fri, 22 Oct 2021 03:51:22 -0400 Received: from monster (unknown [82.65.85.131]) by smtp1-g21.free.fr (Postfix) with ESMTPS id CE9B0B00568; Fri, 22 Oct 2021 09:51:18 +0200 (CEST) From: Florent Flament To: Bernhard Voelker Subject: Re: bug#51311: [PATCH] echo: update --help to document edge cases In-Reply-To: <77132c1d-9bf1-64c0-aec8-b83a847ca82f@bernhard-voelker.de> (message from Bernhard Voelker on Thu, 21 Oct 2021 22:54:08 +0200) Date: Fri, 22 Oct 2021 09:51:18 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 51311-done Cc: 51311-done@debbugs.gnu.org, P@draigBrady.com, bob@proulx.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Bernhard Voelker writes: > On 10/21/21 15:14, Florent Flament wrote: >> NOTE: printf(1) is a preferred alternative, which doesn't share echo's >> inability to handle edge cases. > > I'm not sure that just mentioning "edge cases" will remind people either > that they are falling into such particular edge case. I agree that my sentence is not good, because "edge cases" is too vague. And so far I haven't been able to find a good one liner to express echo's drawbacks. > P=C3=A1draig Brady writes: >> +NOTE: printf(1) is a preferred alternative, with more standard option h= andling.\ > > Therefore, I'd prefer Padraig's shorter sentence: it expresses the matter > positively while the latter proposal tries to explain via negative > wording. I believe that "with more standard option handling" is too vague as well, and doesn't convey the issue with echo. > If we want to be more explicit, then we'd have to name examples where > printf(1) is superior to echo(1) - or the shell's echo builtin. I agree. Examples could make the point clearer. > But IMO the whole point is two-fold: if someone doesn't have enough exper= ience > to understand the edge cases, then eventually the usage of printf with the > often complex format specifiers is also too much. I believe that GNU users don't understand echo's drawbacks because they aren't documented. Therefore users need to have enough experience to have been confronted to undocumented echo related issues. I don't believe that the printf command is complex. It is not used because users are not aware that it exists, or don't understand why it is a better alternative to echo. > Finally, I think Padraig's suggestion had the best tradeoff between point= ing > out the matter and getting too much into details. It is an improvement over current situation, but I would argue to go a little bit further. I can understand that one would want to keep the command's help message short to avoid drowning the user into details. However, when a user types "man echo", he/she wants to have details about the command's behavior. I see the man page as the reference documentation of the command, and I expect to find all of its drawbacks that have been identified so far. I see the info documentation as a reference book that centralizes the information a user would need to properly use the operating system, possibly with more details, examples and anecdotes. Therefore, I would argue for a slightly updated version of P=C3=A1draig's sentence in echo's help message: NOTE: printf(1) is a preferred alternative (see echo(1) man page). Then I would add the note that Glenn and Franck proposed to echo's man page: For historical and back-compatibility reasons, certain bare option-like strings cannot be passed to echo as non-option arguments. The only way to echo the string '-n', for instance, is to specify the dash in either octal or hexadecimal representation (e.g. 'echo -e "\x2dn"'). It is therefore not advisable to use echo(1) for printing unknown or variable arguments. More generally, printf(1) is recommended as a more modern and flexible replacement for tasks historically performed by echo(1). Ideally, The "echo invocation" info page should be updated as well with a similar note, and possibly with some examples. Here's a (slightly updated) example from Bob Proulx. Do you expect this behavior when running this and typing "-n" as its input ? printf "What do you want me to say? " IFS=3D read -r phrase echo $phrase # Noooo! printf "What do you want me to say? " IFS=3D read -r phrase printf "%b\n" "$phrase" # Yes! The above shows input from an untrusted source. It's "tainted". It should not be used without caution. I believe that these kind of details are what makes the difference betwen ok software and great software. Also, I think that such an update may prevent programmers from going into troubles, and maybe help them fix existing code. Have a great day, Florent From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 22 10:21:58 2021 Received: (at 51311) by debbugs.gnu.org; 22 Oct 2021 14:21:58 +0000 Received: from localhost ([127.0.0.1]:33417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdvQj-0006Re-Tn for submit@debbugs.gnu.org; Fri, 22 Oct 2021 10:21:58 -0400 Received: from mail-wm1-f53.google.com ([209.85.128.53]:50962) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdvQe-0006RM-V1 for 51311@debbugs.gnu.org; Fri, 22 Oct 2021 10:21:57 -0400 Received: by mail-wm1-f53.google.com with SMTP id o24so3113430wms.0 for <51311@debbugs.gnu.org>; Fri, 22 Oct 2021 07:21:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Tdlb5+zTm7j3hNPAavM8/bhTDuwEnKjWkE3QUD7j+Ts=; b=A7EB/kMYG9XlzHaMP5cIWJuwTLWYnzViWAZNIYBCLcbSUNa6WMAdUk2UsmY6vb2Wnb o8px9MTkhC7iTl6FFzModEsFsjQOiMf4kkAbhb2VnIKbvreVTn8Y94c3xvZukMyAq/Ne 40oxMuSqoagwenXeUckAM7kXIU++B5iQ5uakBR/qHcjaAuypMBPnhxDWmWbT/cc8H/yF lmepuMjLAVuHqj2Ko/BhY/jKd3GNA1Dgd/zlhY/Uot6SVy64CHHB6KE2Ljlpfo9ypZY4 yEJ+rbhR1lO8LsreIRx8TKUlPw/NY3+JsiRNOHOM4HQFeqTB1xGVq9Xm3r3cXihlYT4j KIeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Tdlb5+zTm7j3hNPAavM8/bhTDuwEnKjWkE3QUD7j+Ts=; b=PnITE40MV1sjTWjehDJK6Fi5nGahKayxlX0AYNM5ytMAo5wdCnHuNH1lu38ZfDojxQ 6tt1vFwfnf3J5HkzB38x8NDD1sbp3VKc1INMcVzSatWhoUOfo1gUFtZo39/X2axHp1ML vbdruYic1V+YpjCZWP+PbE4omRutfjoP/NxD5cy00MKFECSp+FaQUXF9UlsFlNCfR9E8 bAd+qZM5EVie9okpm0DqJ5lOusY7NH7mvMxTmQ6WgA5D5DC1Lw6oKPV2+waQ4c31bF4O gB/dQpMWxfIK4/YHWYP5ZX8dpP7WQ5srxcgostZc6d2R5T+JbQjxy3Hu5cPyjKGNwru3 6+LA== X-Gm-Message-State: AOAM532x5QiUoRD/Ex2/K52v2xGFhm2sUhfHGn6KqFTESkYvquUqwopZ /8lWAsSo4D0cPbaZrLNxDF+zOSD5SgRImbBR X-Google-Smtp-Source: ABdhPJzLpbMsRb9wzCnfdflNH4Me5DaqYRTfMG539bKaAUjpV3BJutXuCe90LlvrVW+4IJrfiWa3dg== X-Received: by 2002:a05:600c:4f08:: with SMTP id l8mr21646wmq.47.1634912506715; Fri, 22 Oct 2021 07:21:46 -0700 (PDT) Received: from localhost.localdomain (86-40-129-104-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.40.129.104]) by smtp.googlemail.com with UTF8SMTPSA id q14sm2510991wrr.28.2021.10.22.07.21.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 22 Oct 2021 07:21:46 -0700 (PDT) Subject: Re: bug#51311: [PATCH] echo: update --help to document edge cases To: Bernhard Voelker , Florent Flament References: <77132c1d-9bf1-64c0-aec8-b83a847ca82f@bernhard-voelker.de> From: =?UTF-8?Q?P=c3=a1draig_Brady?= Message-ID: <4254b74e-a5f5-3477-4d85-586f168043be@draigBrady.com> Date: Fri, 22 Oct 2021 15:21:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0 MIME-Version: 1.0 In-Reply-To: <77132c1d-9bf1-64c0-aec8-b83a847ca82f@bernhard-voelker.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 51311 Cc: 51311@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) On 21/10/2021 21:54, Bernhard Voelker wrote: > On 10/21/21 15:14, Florent Flament wrote: >> Pádraig Brady writes: >>> +NOTE: printf(1) is a preferred alternative, with more standard option handling.\ > >> I believe that it misses the point. It is still not clear that the echo >> command doesn't behave as one would expect for a few edge cases. >> >> Maybe something like this would be closer to what I'm trying to express: >> >> NOTE: printf(1) is a preferred alternative, which doesn't share echo's >> inability to handle edge cases. > > I'm not sure that just mentioning "edge cases" will remind people either > that they are falling into such particular edge case. > > Therefore, I'd prefer Padraig's shorter sentence: it expresses the matter > positively while the latter proposal tries to explain via negative wording. > > If we want to be more explicit, then we'd have to name examples where > printf(1) is superior to echo(1) - or the shell's echo builtin. > But IMO the whole point is two-fold: if someone doesn't have enough experience > to understand the edge cases, then eventually the usage of printf with the > often complex format specifiers is also too much. > Finally, I think Padraig's suggestion had the best tradeoff between pointing > out the matter and getting too much into details. Thanks for all the input. I've now pushed the following to address this: https://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=f60a3981c Notes: - Brevity in --help and man pages is a feature - I kept the existing NOTE: style in --help to avoid a separate [NOTES] in man - I only detailed the edge cases in the info manual, as directing users to printf(1) is the better most general option - It's easy to get to online info pages now by following the link at the bottom of all man pages cheers, Pádraig From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 22 10:58:46 2021 Received: (at 51311) by debbugs.gnu.org; 22 Oct 2021 14:58:46 +0000 Received: from localhost ([127.0.0.1]:33593 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdw0L-0001Nt-Rf for submit@debbugs.gnu.org; Fri, 22 Oct 2021 10:58:46 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:57813) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdw0I-0001Na-Qq for 51311@debbugs.gnu.org; Fri, 22 Oct 2021 10:58:44 -0400 Received: from [192.168.101.10] ([91.12.164.137]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MdNHa-1nCzhi3lr6-00ZQat; Fri, 22 Oct 2021 16:58:34 +0200 Message-ID: Date: Fri, 22 Oct 2021 16:58:33 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: bug#51311: [PATCH] echo: update --help to document edge cases Content-Language: en-US To: =?UTF-8?Q?P=c3=a1draig_Brady?= , Florent Flament References: <77132c1d-9bf1-64c0-aec8-b83a847ca82f@bernhard-voelker.de> <4254b74e-a5f5-3477-4d85-586f168043be@draigBrady.com> From: Bernhard Voelker In-Reply-To: <4254b74e-a5f5-3477-4d85-586f168043be@draigBrady.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:us4J8cfcsXBCjxvumsKR1xhQPo9L+egWzsGymsqvC05dgVNUwzV fJULm8oAhxU8+5Li3WVUAZ42YXswrCdGUP5LDqTblywBUVMvqojJchDf19Tznod9oRD3Ptw Zt6e4laaQI0yH/aQY3p2Ka5GbpePBqtKaLHT58S9pDfeRzyENyaejI9Tx2sG6OyeZ4mm8HG 0MXYZGP4TMgBCNso+zpwg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:MT+uF2X/brQ=:RakGHNJwpvuGZ+0R0RrfBo AwZoP0xhTi1XNcKYM5gSUP+MigmBdtOhf3vdtScmw1RtqNJjPMnkxZG6rO11Popg7ev4xIjtp khD3IoUdA7fBpX3DVJDOOHAAMy8X1pIcs509mjXo4hqKj1BOJA1905huMe7GFjmfDP1rbRdPA +9F07rXhGg/uBk4HEXtWtgpnpchxE6dk7x9yBFEksciSA6d2V1lTdyarnaClbxvDKmk4vCC1X qd11tH0gosJvlZOcAESRgrVZCyby1eoiTd8aga6AWHafnl9iq1DoSZ9E61FcN3cGHSLCZpufR LGM39fLuQ/7u5K5y1D6AUT6uOYalQ420MhVQaRCr5xQ5NcQrmObJdr9YyNnUcMg7e9gtjWhW6 fe3LwdBYSNIlu/ozR7/5nfhjfDxSWcYAeUOzw/xzATOyYA8EcOAv68glu5LIx3TN2jL6rQ/Gu kGZId1G45ief3OSMtWT1MROS+5d72z4kPV5qxXbUw5EgynHvF3hwmwdrzpY85UxBb09ByJWnk jCtTKyH65UnaVvyUxs66mRI9aqQJkCshIVvOXvcQmjzMGSQR/Zo0wYnZ6GVekJas2NXxNfbnT A2m8gGmBhT9tmD/bFqzTeWMb4HbM8+iKInhJB8Qv1QpzAYQT6gqhfzPDWhifbgi9R60FHMLa1 Vin66Vw16Jz4G3D+lu4ol5XiSdGaKbd47PPDGRe5P2gIWrtsdAZ9wX2YCD42zV8n47enVQHDf zu1kC3bHh/eYJAQG X-Spam-Score: -0.1 (/) X-Debbugs-Envelope-To: 51311 Cc: 51311@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.1 (-) On 10/22/21 16:21, Pádraig Brady wrote: > Thanks for all the input. > I've now pushed the following to address this: > > https://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=f60a3981c > > Notes: > - Brevity in --help and man pages is a feature > - I kept the existing NOTE: style in --help to avoid a separate [NOTES] in man > - I only detailed the edge cases in the info manual, > as directing users to printf(1) is the better most general option > - It's easy to get to online info pages now by following the link > at the bottom of all man pages Thanks, I like it. FWIW the biggest trap for users is still that in ~95% of the cases it is the shell's builtin which gets called instead of that of the coreutils. Hence, we've been improving the documentation for the users which unsuspectingly read coreutils 'man echo' instead of that of the shell. Have a nice day, Berny From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 22 15:22:32 2021 Received: (at 51311) by debbugs.gnu.org; 22 Oct 2021 19:22:32 +0000 Received: from localhost ([127.0.0.1]:33814 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1me07c-0004ol-BC for submit@debbugs.gnu.org; Fri, 22 Oct 2021 15:22:32 -0400 Received: from 7.mo552.mail-out.ovh.net ([188.165.59.253]:40145) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1me07Y-0004oZ-Re for 51311@debbugs.gnu.org; Fri, 22 Oct 2021 15:22:30 -0400 Received: from mxplan4.mail.ovh.net (unknown [10.108.16.19]) by mo552.mail-out.ovh.net (Postfix) with ESMTPS id A3D4E21D99; Fri, 22 Oct 2021 19:22:26 +0000 (UTC) Received: from florentflament.com (37.59.142.97) by DAG3EX2.mxp4.local (172.16.2.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Fri, 22 Oct 2021 21:22:25 +0200 Authentication-Results: garm.ovh; auth=pass (GARM-97G0022f14f4ed-9d3a-4caa-9f80-6aa4fccced52, 7D990E17EF2027AC0EEC7AFC3C0A8877BF43E210) smtp.auth=contact@florentflament.com X-OVh-ClientIp: 92.184.105.183 From: Florent Flament To: =?utf-8?Q?P=C3=A1draig?= Brady Subject: Re: bug#51311: [PATCH] echo: update --help to document edge cases In-Reply-To: <4254b74e-a5f5-3477-4d85-586f168043be@draigBrady.com> (message from =?utf-8?Q?P=C3=A1draig?= Brady on Fri, 22 Oct 2021 15:21:44 +0100) Date: Fri, 22 Oct 2021 21:22:25 +0200 Message-ID: <86zgr0sw3y.fsf@flament.me> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.97] X-ClientProxiedBy: DAG1EX2.mxp4.local (172.16.2.2) To DAG3EX2.mxp4.local (172.16.2.6) X-Ovh-Tracer-GUID: f7ea4367-d8dd-49df-9e28-3337ba11d31c X-Ovh-Tracer-Id: 1112952060676438749 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvtddrvddvkedgudefgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecunecujfgurhephffvufgjfffkgggtgfhisehtqhertddttdejnecuhfhrohhmpefhlhhorhgvnhhtucfhlhgrmhgvnhhtuceotghonhhtrggtthesfhhlohhrvghnthhflhgrmhgvnhhtrdgtohhmqeenucggtffrrghtthgvrhhnpeejvdetueelteevkeeklefhleeukedtledtkeegleegteetveekieegfeejjeelhfenucffohhmrghinhepghhnuhdrohhrghenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddrleejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepmhigphhlrghngedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtohhnthgrtghtsehflhhorhgvnhhtfhhlrghmvghnthdrtghomhdprhgtphhtthhopefrsegurhgrihhguehrrgguhidrtghomh X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 51311 Cc: 51311@debbugs.gnu.org, mail@bernhard-voelker.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) P=C3=A1draig Brady writes: > Thanks for all the input. > I've now pushed the following to address this: > > https://git.sv.gnu.org/gitweb/?p=3Dcoreutils.git;a=3Dcommitdiff;h=3Df60a3= 981c > > Notes: > - Brevity in --help and man pages is a feature > - I kept the existing NOTE: style in --help to avoid a separate [NOTES]= in man > - I only detailed the edge cases in the info manual, > as directing users to printf(1) is the better most general option > - It's easy to get to online info pages now by following the link > at the bottom of all man pages Thanks P=C3=A1draig, this is a great update. Cheers, Florent From unknown Fri Aug 15 14:45:47 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 20 Nov 2021 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator