Re: [PATCH] echo: fix octal escaping with \1...\7

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

On Mon, 2011-10-31 at 07:12 -0600, Eric Blake wrote:
> Scripts that rely on a certain interpretation of "echo '\1'" are broken 
> regardless of how dash behaves; but that said, since POSIX doesn't 
> require dash's current behavior, and since the proposed patch makes dash 
> both smaller and more like other shells in treating it as an extension 
> that means a literal 1 rather than an octal escape, I would be in favor 
> of making the change in dash.

The problem with that is that the patch makes dash behave differently
from other shells in its interpretation of printf's %b format. bash, for
instance, does accept \1 escape sequences there, as an extension to
POSIX. Currently, so does dash. With this patch, it stops working in
dash. And unsharing the code between echo and printf would probably make
dash larger.

There's also another problem: the patch doesn't work as advertised
anyway. It should continue to make echo "\0101" print a single character
followed by newline. Instead, with that patch dash takes \010 as an
escape sequence, and then follows it by 1 and a newline.


To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at

[LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

Powered by Linux