bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GNU sed 4.2.1 \x bug ?


From: Matija Nalis
Subject: GNU sed 4.2.1 \x bug ?
Date: Fri, 3 Dec 2010 20:53:21 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

I'm using "GNU sed version 4.2.1", and I'm having issues with "\x" expansion
as folows:

If \x escape sequence in LHS resolves to some character which has special
meaning in sed LHS (like "^", "\", ...), GNU sed does not use it as
hex-escaped, but instead as if it was literaly that character.

For example:
echo 'a^c' | sed -e 's/\x5e/b/'
should produce output "abc" (as it does in "ssed" or "perl -pe"), but in GNU
sed it produces "ba^c".

or,

echo 'a\\c' | sed -e 's/\x5c/b/'
should again produce output "abc", but in GNU sed it terminates sed with error:
"sed: -e expression #1, char 10: Trailing backslash"
(as it interprets it as "sed -e 's/\/b/'" and not as "sed -e 's/\\/b/'")

There are several more such problematic characters.

Proposed solution: all such \xNN escapes should be treated as if the characters 
are really escaped, for example '\x5e' in LHS should be treated like '\^' and
not like special-meaning '^'.

(this issue is also reported to Debian Bug #605142
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=605142 )

Thanks,
Matija

-- 
Opinions above are GNU-copylefted.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]