[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in od
From: |
Bob Proulx |
Subject: |
Re: Bug in od |
Date: |
Fri, 18 Jun 2004 21:23:27 -0600 |
User-agent: |
Mutt/1.3.28i |
Keith P. Boruff wrote:
> I discovered an 'endian' bug when executing od in the following manner:
> od -Ax -t x2 baseball.txt on my Linux O/S (with an Intel processor).
Thanks for the report. But I looked at the files but I could not see
a bug there. The data looked fine on each machine, big and little,
endian. What output were you expecting?
> The dump for this command is in the file 'little_endian.txt'.
>
> Seeing that the data layout of this execution was corrupted due to the
> endian problem, I also ran the same command (same args) on a Sun
> workstation. The results are on big_endian.txt
Corrupted how? Please be specific.
> Also included is the file 'baseball.txt' for which od processed.
Let's try something simple.
echo abcd | od -tx1
0000000 61 62 63 64 0a
But you were using -tx2 which means to use two bytes. Which means
that it will be different on different machines. The bytes might be
in "backwords" storage order.
On an ascii little endian machine:
echo abcd | od -tx1
0000000 61 62 63 64 0a
echo abcd | od -tx2
0000000 6261 6463 000a
echo abcd | od -tx4
0000000 64636261 0000000a
On an ascii big endian machine:
echo abcd | od -tx1
0000000 61 62 63 64 0a
echo abcd | od -tx2
0000000 6162 6364 0a00
echo abcd | od -tx4
0000000 61626364 0a000000
Please report back to the mailing list how this resolves for you.
Thanks
Bob
- Bug in od, Keith P. Boruff, 2004/06/18
- Re: Bug in od,
Bob Proulx <=