On 2010-08-15 01:08 +0400, Dmitry Groshev wrote:

> If an escape's parameter makes no sense, escape sequence should be
> left untranslated - just the way "\x" handles things like "\xZZ". Make
> "\c" check that its parameter is an ASCII char, and the problem will
> be fixed.
> Unless for some reason you consider this bug worth preserving. :-)

Guess the code blindly outputs the next char & 0x1f. Which is
a good thing in a way because if it did check that the next char
is between 0x3f and 0x5e, there would be no way to produce
"\x1c" through \c :

$ sh <<\EOF
printf '%s' $'\c\' | xxd
EOF
sh: line 1: unexpected EOF while looking for matching `''
sh: line 2: syntax error: unexpected end of file
$ sh <<\EOF
printf '%s' $'\c\\' | xxd
EOF
0000000: 1c5c                                     .\

Of course there's $'\x1c' and $'\034' so it's kind of moot.

-- 
André Majorel http://www.teaser.fr/~amajorel/

Reply via email to