echo does not handle escapes any more

Bug #116226 reported by Martin Pitt
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bash (Ubuntu)
Won't Fix
Medium
Unassigned

Bug Description

Binary package hint: bash

Current gutsy's bash does not handle escapes correctly:

$ echo -ne '\101'
\101

It should evaluate the escape instead of printing it in verbatim. That's what the standalone echo and printf are doing:

$ /bin/echo -ne '\101'
A
$ printf '\101'
A

bash's echo behaves correctly in Etch and Edgy, too (bash 3.1). I didn't test Feisty.

Revision history for this message
Martin Pitt (pitti) wrote :

echo '\0101' works, but it should IMHO still keep the old behaviour too to not break compatibility with existing scripts.

Revision history for this message
Bill Egert (begert) wrote :

Tested this in Feisty and problem exists.

I thought it amusing that when trying to look at the versions I got this:

:~$ /bin/echo --version
echo (GNU coreutils) 5.97
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

:~$ echo --version
--version

Revision history for this message
Bill Egert (begert) wrote :

Was able to reproduce in Gutsy and Feisty

Changed in bash:
status: New → Confirmed
Matthias Klose (doko)
Changed in bash:
importance: Undecided → Medium
Revision history for this message
Matthias Klose (doko) wrote :

this is behaviour changed upstream:

"Changed from 3.1 to 3.2, for Posix
conformance. `echo -e' (and the corresponding xpg_echo shell option)
now conform to the POSIX standard and accept 0-3 octal digits after a
(required) leading `\0'.

The xpg_echo and `echo -e' code should be identical. There are lots of
ways to indicate that backslash escapes should be interpreted -- maybe
too many -- but when they are, they should behave consistently.

This is why portable applications should use printf. "

Changed in bash:
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.