bug-bash
[Top][All Lists]
Advanced

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

Re: Consume only up to 8 bit octal input for backslash-escaped chars (ec


From: Chet Ramey
Subject: Re: Consume only up to 8 bit octal input for backslash-escaped chars (echo, printf)
Date: Tue, 07 Dec 2010 20:19:34 -0500
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.8) Gecko/20100802 Lightning/1.0b2 Thunderbird/3.1.2

On 12/7/10 11:12 AM, Roman Rakus wrote:
> This one is already reported on coreutils:
> http://debbugs.gnu.org/cgi/bugreport.cgi?msg=2;bug=7574
> 
> The problem is with numbers higher than /0377; echo and printf consumes all
> 3 numbers, but it is not 8-bit number. For example:
> $ echo -e '\0610'; printf '\610 %b\n' '\610 \0610'
> Should output:
> 10
> 10 10 10
> instead of
>
> � � �

No, it shouldn't.  This is a terrible idea.  All other shells I tested
behave as bash does*, bash behaves as Posix specifies, and the bash
behavior is how C character constants work.  Why would I change this?

(*That is, consume up to three octal digits and mask off all but the lower
8 bits of the result.)

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]