From: Harald van Dijk <harald@gigawatt.nl>
To: dash@vger.kernel.org
Subject: Re: [PATCH] echo: fix octal escaping with \1...\7
Date: Mon, 31 Oct 2011 19:07:24 +0100 [thread overview]
Message-ID: <1320084444.28517.11.camel@localhost.localdomain> (raw)
In-Reply-To: <4EAE9ECB.4040607@redhat.com>
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.
Cheers,
Harald
next prev parent reply other threads:[~2011-10-31 18:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-25 21:58 [PATCH] echo: fix octal escaping with \1...\7 Mike Frysinger
2011-10-26 7:59 ` Stephane CHAZELAS
2011-10-31 3:41 ` Herbert Xu
2011-10-31 4:23 ` Mike Frysinger
2011-10-31 13:12 ` Eric Blake
2011-10-31 13:35 ` Paul Gilmartin
2011-10-31 14:03 ` Eric Blake
2011-10-31 14:56 ` Stephane CHAZELAS
2011-10-31 18:07 ` Harald van Dijk [this message]
2011-10-31 18:39 ` Mike Frysinger
2011-10-31 18:48 ` Harald van Dijk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1320084444.28517.11.camel@localhost.localdomain \
--to=harald@gigawatt.nl \
--cc=dash@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox