25 Oct 2011 23:58
[PATCH] echo: fix octal escaping with \1...\7
Mike Frysinger <vapier <at> gentoo.org>
2011-10-25 21:58:04 GMT
2011-10-25 21:58:04 GMT
POSIX states that octal escape sequences should take the form \0num when using echo. dash however additionally treats \num as an octal sequence. This breaks some packages (like libtool) who attempt to use strings with these escape sequences via variables to execute sed (since sed ends up getting passed a byte instead of a literal \1). The code that consumes this sequence includes a comment that indicates it doesn't actually mean to do this. So simplify the code a bit by ignoring these sequences that lack a leading 0 and falling through to the existing escape parsing logic. before: $ echo '\1' | hexdump -C 00000000 01 0a |..| after: $ echo '\1' | hexdump -C 00000000 5c 31 0a |\1.| (existing \01 sequence still works the same) This also slightly shrinks the resulting compiled code :). Signed-off-by: Mike Frysinger <vapier <at> gentoo.org> --- Note: I assume this still applies to the latest git. The last checkout I have is from Sep 2010 though, and kernel.org does not yet have the dash tree back on it. src/bltin/printf.c | 16 ++++------------ 1 files changed, 4 insertions(+), 12 deletions(-)(Continue reading)
RSS Feed