[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#17961: "od -c" producing numbers greater than 255 ?
From: |
Bernhard Voelker |
Subject: |
bug#17961: "od -c" producing numbers greater than 255 ? |
Date: |
Mon, 07 Jul 2014 01:55:07 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
tag 17961 notabug
close 17961
stop
On 07/06/2014 08:54 PM, Sebastian Pipping wrote:
> I have observed od printing byte values greater than 255 (e.g 302 and
> 303) and wonder if that's a bug and if not what's the idea behind it.
>
> I'm running coreutils version 8.22.
>
> My command to re-produce is
>
> python3 -c 'for i in range(256): print("%c" % i, end="")' | od -c
Thanks for the bug report. However, there seems to be some
misunderstanding on your side about what 'od -c' does:
the default output format is to use octal number, which you can
already see in the first line from the printed numbers:
$ python3 -c 'for i in range(256): print("%c" % i, end="")' | od -c | head -n1
0000000 \0 001 002 003 004 005 006 \a \b \t \n \v \f \r 016 017
Therefore, od(1) prints up to 377 (octal) in your case - which is 255 decimal:
$ python3 -c 'print("%o" % 255)'
377
Have a nice day,
Berny