Package: dash
Version: 0.5.11+git20210903+057cd650a4ed-9
Severity: normal
X-Debbugs-Cc: [email protected]
Hi,
I'd like if dash(1)'s built-in echo(1) would treat -n as a string.
POSIX specifies the behavior as implementation-defined, but XSI
(see standards(7)) is stricter, and specifies that echo(1) has no
options (-n has to be treated as any other string).
Considering that dash(1) tends to be minimal, the minimal thing to
do is to not implement the option.
Cheers,
Alex
-- System Information:
Debian Release: bookworm/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 5.19.0-1-amd64 (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages dash depends on:
ii debianutils 5.7-0.3
ii dpkg 1.21.9
ii libc6 2.35-1
dash recommends no packages.
dash suggests no packages.
-- debconf information:
* dash/sh: true
Subject: Re: Bug#1021418: builtin: echo: Treat -n as a string
Date: Fri, 11 Nov 2022 20:53:44 +0100
* Alejandro Colomar <[email protected]>, 2022-10-08 03:45:
>I'd like if dash(1)'s built-in echo(1) would treat -n as a string.
That's not gonna happen. As per Policy §10.4, /bin/sh scripts can rely
on the current “echo -n” semantics. And of course many of them do rely
on it.
--
Jakub Wilk
Control: tags -1 + upstream wontfix
Additionally, there is historical precedent since V7 UNIX
(and a little-known "BSD" system that derives from it)
for echo -n, so the dash minimalness argument also doesn't hold,
since the minimal thing is to not touch it.
Similarly, PWB/CB-UNIX/SysIII echo exists as printf %b
("XSI" is a stand-in for "alas, SysIII-and-friends do this
and we ratified it when the standard was just XPG/SUS"),
and the standard encourages you to Not Use echo at all ‒
if there's backslash-escapes they /may/ get intepreted too!
For echo use printf %s\n, for echo -n use printf %s,
for SysIII-style echo-with-escapes use printf %b\n
(or convert to a native printf expression).
The only thing echo makes sense for is to Just Write A New-Line
if you don't give it arguments, and even then…
наб
Acknowledgement sent
to Alejandro Colomar <[email protected]>:
Extra info received and forwarded to list. Copy sent to Andrej Shadura <[email protected]>.
(Thu, 15 Dec 2022 22:09:03 GMT) (full text, mbox, link).
Hi наб!
On 12/15/22 23:00, наб wrote:
> Control: tags -1 + upstream wontfix
>
> Additionally, there is historical precedent since V7 UNIX
> (and a little-known "BSD" system that derives from it)
> for echo -n, so the dash minimalness argument also doesn't hold,
> since the minimal thing is to not touch it.
>
> Similarly, PWB/CB-UNIX/SysIII echo exists as printf %b
> ("XSI" is a stand-in for "alas, SysIII-and-friends do this
> and we ratified it when the standard was just XPG/SUS"),
> and the standard encourages you to Not Use echo at all ‒
> if there's backslash-escapes they /may/ get intepreted too!
>
> For echo use printf %s\n, for echo -n use printf %s,
> for SysIII-style echo-with-escapes use printf %b\n
> (or convert to a native printf expression).
> The only thing echo makes sense for is to Just Write A New-Line
> if you don't give it arguments, and even then…
Thanks for the detailed rationale + advice!
Cheers,
Alex
>
> наб
--
<http://www.alejandro-colomar.es/>
Debbugs is free software and licensed under the terms of the GNU General
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.