GNU bug report logs - #21416
"--" syntax for ignoring flags doesn't seem to work right with GNU /bin/echo

Previous Next

Package: coreutils;

Reported by: "Robert \"Finny\" Merrill" <rfm <at> arista.com>

Date: Fri, 4 Sep 2015 19:11:02 UTC

Severity: normal

Tags: notabug

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eric Blake <eblake <at> redhat.com>
To: "Robert \"Finny\" Merrill" <rfm <at> arista.com>
Cc: 21416-done <at> debbugs.gnu.org
Subject: bug#21416: "--" syntax for ignoring flags doesn't seem to work right with GNU /bin/echo
Date: Fri, 4 Sep 2015 16:42:48 -0600
[Message part 1 (text/plain, inline)]
On 09/04/2015 04:34 PM, Eric Blake wrote:
> [As it is, bash has a bug:
> $ (shopt -s xpg_echo; echo -e)
> 
> should output '-e', but currently outputs nothing.  Also, bash does not
> quite treat POSIXLY_CORRECT=1 (also spelled 'set -o posix') as the
> override to turn on full POSIX compliance, as it leaves xpg_echo as a
> separate knob; ideally, turning on posix compliance in bash should turn
> on xpg_echo - but enough people are used to the old behavior that it was
> decided to keep the knobs separate]

Maybe I spoke too soon. It looks like bash needs BOTH xpg_echo and posix
mode at the same time, either one in isolation is not enough:

$ for opt in '' 'shopt -s xpg_echo' 'set -o posix' \
     'shopt -s xpg_echo; set -o posix'; do
    bash -c "echo 'trying $opt'; ${opt:-:}; echo -e"
  done
trying

trying shopt -s xpg_echo

trying set -o posix

trying shopt -s xpg_echo; set -o posix
-e

$

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

This bug report was last modified 9 years and 265 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.