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



Reply via email to