[Bug 268929] Re: Wrong escape character processing in dash
*** This bug is a duplicate of bug 259671 *** https://bugs.launchpad.net/bugs/259671 ** This bug has been marked a duplicate of bug 259671 dash: echo builtin interprets backslash escape sequences * You can subscribe to bug 259671 by following this link: https://bugs.launchpad.net/ubuntu/+source/dash/+bug/259671/+subscribe -- Wrong escape character processing in dash https://bugs.launchpad.net/bugs/268929 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 268929] Re: Wrong escape character processing in dash
You can avoid these problems by using the printf utility instead of echo. -- Wrong escape character processing in dash https://bugs.launchpad.net/bugs/268929 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 268929] Re: Wrong escape character processing in dash
Same bug exists in 10.04... # ls -l /bin/sh lrwxrwxrwx 1 root root 4 2010-04-27 13:20 /bin/sh - dash # dpkg -l dash ii dash 0.5.5.1-3ubunt POSIX-compliant shell -- Wrong escape character processing in dash https://bugs.launchpad.net/bugs/268929 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 268929] Re: Wrong escape character processing in dash
It's actually worse than that. For example, try echoing \1 (slash and one), which shows up often when making sed scripts. Here's what happens in dash-0.5.5.1: $ echo '\1' (outputs 0x01 0x0A, which is only visible with od) Here it's incorrectly treated as an octal sequence, even though it does not begin with 0. \01 should be required for the above output, and no such processing should happen in single quotes anyway. $ echo '\\1' \1 Here It processes the escape sequence again in single quotes. bash would output \\1 $ echo '\\\1' \ Both backslash and \1 are interpreted. $ echo \1 Outputs 0x01 0x0A again. $ echo \\1 Surprizingly outputs 0x01 0x0A. Where did that come from? Overall, there simply is no way to output \1 into a sed script that will work in both bash and dash. -- Wrong escape character processing in dash https://bugs.launchpad.net/bugs/268929 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 268929] Re: Wrong escape character processing in dash
This also breaks the following script: target='\1.o' echo foo.c | sed -e 's/\([a-z]*\).c/'$target'/' Ubuntu /bin/dash: $ target='\1.o' $ set -x $ echo foo.c | sed -e 's/\([a-z]*\).c/'$target'/' + echo foo.c + sed -e s/\([a-z]*\).c/1.o/ 1.o Ubuntu /bin/bash: $ target='\1.o' $ set -x $ echo foo.c | sed -e 's/\([a-z]*\).c/'$target'/' + sed -e 's/\([a-z]*\).c/\1.o/' + echo foo.c foo.o HP-UX /bin/sh $ target='\1.o' $ set -x $ echo foo.c | sed -e 's/\([a-z]*\).c/'$target'/' + echo foo.c + sed -e s/\([a-z]*\).c/\1.o/ foo.o As you can see, sed is called without the backslash in the replacement command when dash is used: sed ... /1.o/ instead of the expected sed ... /\1.o/ -- Wrong escape character processing in dash https://bugs.launchpad.net/bugs/268929 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs