Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16759

Re: echo builtin doesn't handle end-of-options flag

Path csiph.com!fu-berlin.de!usenet.stanford.edu!not-for-mail
From Eli Schwartz <eschwartz@archlinux.org>
Newsgroups gnu.bash.bug
Subject Re: echo builtin doesn't handle end-of-options flag
Date Sun, 16 Aug 2020 12:26:06 -0400
Lines 107
Approved bug-bash@gnu.org
Message-ID <mailman.2308.1597595182.2739.bug-bash@gnu.org> (permalink)
References <F122E6E9-6067-45EF-8D18-2B1EBF0D5917@codegnome.org> <737d2184-8b59-0eee-4c56-41f7a67d8f88@redhat.com> <ec2197fd-a742-00b6-ebf6-6a3a217510f4@archlinux.org>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="xDHwhRsVP7GBwkD33sTX9Tc2BDmOZJ0NA"
X-Trace usenet.stanford.edu 1597595182 6190 209.51.188.17 (16 Aug 2020 16:26:22 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
X-Spam-BL-Results
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=orion; t=1597595169; bh=wjHtnQeLjSXmbp+0S+t9UagIkTQi64VTq+5ZQYSjNTk=; h=Subject:To:References:From:Date:In-Reply-To; b=P5S1JqKXx0IIxKqKzeveSVcSPiA0hwmwT/Jo+5Fr8SZqPM8FMzUvmxH9FrNce4zg9 rdwfIyrF+GjyKy5rh1PeqBhxTOyoxASL5YSX4lK7/zwD9+GOZnkO+6f7Vg0y0Pl2WM rf1/FPyxGiySypCFSLxpUMXdXkQIfq9TL7K3sm2sC9PH89z35nh9p3XGvYWRoA4QYn m7Lxpy/nBwbjbYI+hNW0St5fVCC0WDlXEGOwrT8vVe/RcoAM9tUFtOpPqM45eMvkAc NPKq/sLio8CBEQLrpsb6ol6Q8j3wgDdWGInMw2ps0F/E3CdLLpLZAXIJni/lQHcOHU wRwC8U7LetJ22FfjBC92x48uU4/7GgU4I8B0muDRqUPlSQKtX3LlO94m7WxWbfJu+t MKguTZE4mukxNAVylL1IUBS57xMD4MDkONkxfxIgRplAtI6ACHR1eGP252u3blYVyd 2KvoQU6SWsTBUJ9OdK1EBui1EUDgCburbyXDXvxTi1LN6v4S4x5Fx753x7bOBbTbBc oFJ1SDE5NeOhqlqdd7h9W6cGS8YFeAgF5s2JOewcJruIBlDWCaBikot1+915K7G7tB c8RyOKzqOY8GS/n8QZZI759GzrUHaUUiw83U2cBlhg6bASRzWcSnjMyHYwiI2dtHzc n3FW8LE6N56gAEIjiqsXPr5Y=
X-Clacks-Overhead GNU Terry Pratchett
In-Reply-To <737d2184-8b59-0eee-4c56-41f7a67d8f88@redhat.com>
Received-SPF pass client-ip=2a01:4f8:160:6087::1; envelope-from=eschwartz@archlinux.org; helo=orion.archlinux.org
X-detected-operating-system by eggs.gnu.org: No matching host in p0f cache. That's all we know.
X-Spam_score_int -53
X-Spam_score -5.4
X-Spam_bar -----
X-Spam_report (-5.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no
X-Spam_action no action
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <ec2197fd-a742-00b6-ebf6-6a3a217510f4@archlinux.org>
X-Mailman-Original-References <F122E6E9-6067-45EF-8D18-2B1EBF0D5917@codegnome.org> <737d2184-8b59-0eee-4c56-41f7a67d8f88@redhat.com>
Xref csiph.com gnu.bash.bug:16759

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On 8/16/20 12:21 PM, Eric Blake wrote:
> On 8/16/20 10:47 AM, Todd A. Jacobs wrote:
> 
>> Description:
>>          The echo builtin accepts options, but does not seem to handle
>>          `--` correctly as the end of options.
> 
> The correct behavior for echo is described here:
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html
> "The echo utility shall not recognize the "--" argument in the manner
> specified by Guideline 10 of XBD Utility Syntax Guidelines; "--" shall
> be recognized as a string operand."
> 
>> The expected behavior
>>          would be for -- to be removed, and any following flag-like
>>          substrings printed as-is.
> 
> Your expectations are wrong, they contradict what POSIX says.
> 
>>
>> Repeat-By:
>>          echo "-n"         # "" but expecting "-n"
> 
> POSIX says this one is implementation-defined; so whether -n is treated
> as an option or as a string to echo has to be documented by the
> implementation (bash documents treating it as an option).

Err...

"Implementations shall not support any options."

>>          echo -- -n foo    # -- -n foo
> 
> POSIX says this has to output '-- -n foo' and a newline. -n wasn't
> first, so you no longer have the implementation-defined behavior, but
> well-defined.
> 
>>          echo -- "-n foo"  # -- -n foo
> 
> Also well-defined.
> 
> I see nothing in your report about bash disobeying POSIX, but rather
> confusion on your part about what POSIX actually requires.

bash does disobey POSIX, but not in the manner which the report specifies.

-- 
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: echo builtin doesn't handle end-of-options flag Eli Schwartz <eschwartz@archlinux.org> - 2020-08-16 12:26 -0400

csiph-web