Debian Bug report logs - #1021418
builtin: echo: Treat -n as a string

version graph

Package: dash; Maintainer for dash is Andrej Shadura <[email protected]>; Source for dash is src:dash (PTS, buildd, popcon).

Reported by: Alejandro Colomar <[email protected]>

Date: Sat, 8 Oct 2022 01:48:02 UTC

Severity: normal

Tags: upstream, wontfix

Found in version dash/0.5.11+git20210903+057cd650a4ed-9

Reply or subscribe to this bug.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to [email protected], [email protected], Andrej Shadura <[email protected]>:
Bug#1021418; Package dash. (Sat, 08 Oct 2022 01:48:04 GMT) (full text, mbox, link).


Acknowledgement sent to Alejandro Colomar <[email protected]>:
New Bug report received and forwarded. Copy sent to [email protected], Andrej Shadura <[email protected]>. (Sat, 08 Oct 2022 01:48:05 GMT) (full text, mbox, link).


Message #5 received at [email protected] (full text, mbox, reply):

From: Alejandro Colomar <[email protected]>
To: Debian Bug Tracking System <[email protected]>
Subject: builtin: echo: Treat -n as a string
Date: Sat, 08 Oct 2022 03:45:11 +0200
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



Information forwarded to [email protected], Andrej Shadura <[email protected]>:
Bug#1021418; Package dash. (Fri, 11 Nov 2022 19:57:05 GMT) (full text, mbox, link).


Message #8 received at [email protected] (full text, mbox, reply):

From: Jakub Wilk <[email protected]>
To: Alejandro Colomar <[email protected]>, [email protected]
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



Information forwarded to [email protected], Andrej Shadura <[email protected]>:
Bug#1021418; Package dash. (Thu, 15 Dec 2022 22:03:02 GMT) (full text, mbox, link).


Acknowledgement sent to наб <[email protected]>:
Extra info received and forwarded to list. Copy sent to Andrej Shadura <[email protected]>. (Thu, 15 Dec 2022 22:03:02 GMT) (full text, mbox, link).


Message #13 received at [email protected] (full text, mbox, reply):

From: наб <[email protected]>
To: Alejandro Colomar <[email protected]>, [email protected]
Subject: Re: Bug#1021418: builtin: echo: Treat -n as a string
Date: Thu, 15 Dec 2022 23:00:46 +0100
[Message part 1 (text/plain, inline)]
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…

наб
[signature.asc (application/pgp-signature, inline)]

Added tag(s) upstream and wontfix. Request was from наб <[email protected]> to [email protected]. (Thu, 15 Dec 2022 22:03:02 GMT) (full text, mbox, link).


Information forwarded to [email protected], Andrej Shadura <[email protected]>:
Bug#1021418; Package dash. (Thu, 15 Dec 2022 22:09:03 GMT) (full text, mbox, link).


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


Message #20 received at [email protected] (full text, mbox, reply):

From: Alejandro Colomar <[email protected]>
To: [email protected]
Subject: Re: Bug#1021418: builtin: echo: Treat -n as a string
Date: Thu, 15 Dec 2022 23:05:50 +0100
[Message part 1 (text/plain, inline)]
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/>
[OpenPGP_signature (application/pgp-signature, attachment)]

Send a report that this bug log contains spam.


Debian bug tracking system administrator <[email protected]>. Last modified: Tue May 13 13:45:48 2025; Machine Name: buxtehude

Debian Bug tracking system

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

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.