A NOTE has been added to this issue. ====================================================================== http://austingroupbugs.net/view.php?id=1222 ====================================================================== Reported By: stephane Assigned To: ====================================================================== Project: 1003.1(2016)/Issue7+TC2 Issue ID: 1222 Category: Shell and Utilities Type: Enhancement Request Severity: Objection Priority: normal Status: New Name: Stephane Chazelas Organization: User Reference: Section: echo utility Page Number: echo Line Number: echo Interp Status: --- Final Accepted Text: ====================================================================== Date Submitted: 2018-12-27 23:49 UTC Last Modified: 2019-04-29 15:39 UTC ====================================================================== Summary: "echo" specification doesn't reflect current implementations (missing -e, -E and - handling) ====================================================================== Relationships ID Summary ---------------------------------------------------------------------- related to 0001206 The echo that supports -n is Bell Labs ... ======================================================================
---------------------------------------------------------------------- (0004375) geoffclare (manager) - 2019-04-29 15:39 http://austingroupbugs.net/view.php?id=1222#c4375 ---------------------------------------------------------------------- On page 2674 line 87124 section echo OPERANDS, change: <blockquote>If the first operand is <b>-n</b>, or if any of the operands contain a <backslash> character, the results are implementation-defined. [XSI]On XSI-conformant systems, if the first operand is <b>-n</b>, it shall be treated as a string, not an option.[/XSI]</blockquote> to: <blockquote>If the first operand consists of a '-' followed by one or more characters from the set { 'e', 'E', 'n' }, or if any of the operands contain a <backslash> character, the results are implementation-defined. [XSI]On XSI-conformant systems, if the first operand consists of a '-' followed by one or more characters from the set { 'e', 'E', 'n' }, it shall be treated as a string to be written.[/XSI]</blockquote> On page 2675 line 87179 section echo APPLICATION USAGE, change: <blockquote>It is not possible to use <i>echo</i> portably across all POSIX systems unless both <b>-n</b> (as the first argument) and escape sequences are omitted.</blockquote> to: <blockquote>It is not possible to use <i>echo</i> portably across all POSIX systems unless escape sequences are omitted, and the first argument does not consist of a '-' followed by one or more characters from the set { 'e', 'E', 'n' }.</blockquote> On page 2676 line 87198 section echo RATIONALE, change: <blockquote>Conforming applications that wish to do prompting without <newline> characters or that could possibly be expecting to echo a <b>−n</b>, should use the <i>printf</i> utility derived from the Ninth Edition system. As specified, <i>echo</i> writes its arguments in the simplest of ways. The two different historical versions of <i>echo</i> vary in fatally incompatible ways. The BSD <i>echo</i> checks the first argument for the string <b>−n</b> which causes it to suppress the <newline> that would otherwise follow the final argument in the output. The System V <i>echo</i> does not support any options, but allows escape sequences within its operands, as described for XSI implementations in the OPERANDS section. The <i>echo</i> utility does not support Utility Syntax Guideline 10 because historical applications depend on <i>echo</i> to echo <i>all</i> of its arguments, except for the <b>−n</b> option in the BSD version.</blockquote> to: <blockquote>Conforming applications that wish to do prompting without <newline> characters or that could possibly be expecting to echo a string consisting of a '-' followed by one or more characters from the set { 'e', 'E', 'n' } should use the <i>printf</i> utility. At the time that the POSIX.2-1992 standard was being developed, the two different historical versions of <i>echo</i> that were considered for standardization varied in incompatible ways. The BSD <i>echo</i> checked the first argument for the string <b>−n</b> which caused it to suppress the <newline> that would otherwise follow the final argument in the output. The System V <i>echo</i> treated all arguments as strings to be written, but allowed escape sequences within them, as described for XSI implementations in the OPERANDS section, including \c to suppress a trailing <newline>. Thus the POSIX.2-1992 standard said that the behavior was implementation-defined if the first operand is <b>-n</b> or if any of the operands contain a <backslash> character. It also specified that the <i>echo</i> utility does not support Utility Syntax Guideline 10 because historical applications depended on <i>echo</i> to echo <i>all</i> of its arguments, except for the <b>−n</b> first argument in the BSD version. The Single UNIX Specification, Version 1 required the System V behavior, and this became the XSI requirement when Version 2 and POSIX.2 were merged with POSIX.1 to form the joint POSIX.1-2001 / Single UNIX Specification, Version 3 standard. This standard now treats a first operand of <b>-e</b> or <b>-E</b> the same as <b>-n</b> in recognition that support for them has become more widespread in non-XSI implementations. Where supported, <b>-e</b> enables processing of escape sequences in the remaining operands (in situations where it is disabled by default), and <b>-E</b> disables it (in situations where it is enabled by default). A first operand containing a combination of these three letters, in the same manner as option grouping, also results in implementation-defined behavior.</blockquote> Issue History Date Modified Username Field Change ====================================================================== 2018-12-27 23:49 stephane New Issue 2018-12-27 23:49 stephane Name => Stephane Chazelas 2018-12-27 23:49 stephane Section => echo utility 2018-12-27 23:49 stephane Page Number => echo 2018-12-27 23:49 stephane Line Number => echo 2019-03-01 10:04 stephane Note Added: 0004272 2019-04-01 16:33 nick Relationship added related to 0001206 2019-04-25 16:17 eblake Note Added: 0004370 2019-04-25 21:46 stephane Note Added: 0004372 2019-04-26 08:49 geoffclare Note Added: 0004373 2019-04-29 15:39 geoffclare Note Added: 0004375 ======================================================================