[Bug 907180] [NEW] od(1) doesn't compensate for Endianness of CPU
Ron Widell
r_widell at bwig.net
Wed Dec 21 06:14:18 UTC 2011
Public bug reported:
Try the following experiment: pick a small binary file on your system
where the data and locations are unequivocally known. I recommend
something like /sys/firmware/acpi/tables/BOOT. Since only root can read
these files, you'll need to prefix each od(1) command with sudo or do
"sudo sh" to get a root command prompt.
Execute the following commands:
1) od -t xz /sys/firmware/acpi/tables/BOOT
2) od -t x2z /sys/firmware/acpi/tables/BOOT
3) od -t x1z /sys/firmware/acpi/tables/BOOT
If you're running on a Little Endian (x86) machine you'll note that what
gets output in the left field is actually what gets loaded into the
CPU's registers & not the order of data in the file. In example 1, a
32-bit integer is loaded while a 16-bit integer is loaded in example 2
and a single byte is loaded into the register in example 3.
Note also that the right hand (ASCII strings) field remains constant in
all 3 examples.
I've never seen this issue on a Big Endian machine, but I'm surprised
that it still occurs this late in time on Little Endian machines.
xxx at yyyyyy:~$ lsb_release -rd
Description: Ubuntu 10.04.3 LTS
Release: 10.04
xxx at yyyyyy:~$ apt-cache policy coreutils
coreutils:
Installed: 7.4-2ubuntu3
Candidate: 7.4-2ubuntu3
Version table:
*** 7.4-2ubuntu3 0
500 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages
100 /var/lib/dpkg/status
7.4-2ubuntu2 0
500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages
** Affects: coreutils (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to coreutils in Ubuntu.
https://bugs.launchpad.net/bugs/907180
Title:
od(1) doesn't compensate for Endianness of CPU
Status in “coreutils” package in Ubuntu:
New
Bug description:
Try the following experiment: pick a small binary file on your system
where the data and locations are unequivocally known. I recommend
something like /sys/firmware/acpi/tables/BOOT. Since only root can
read these files, you'll need to prefix each od(1) command with sudo
or do "sudo sh" to get a root command prompt.
Execute the following commands:
1) od -t xz /sys/firmware/acpi/tables/BOOT
2) od -t x2z /sys/firmware/acpi/tables/BOOT
3) od -t x1z /sys/firmware/acpi/tables/BOOT
If you're running on a Little Endian (x86) machine you'll note that
what gets output in the left field is actually what gets loaded into
the CPU's registers & not the order of data in the file. In example 1,
a 32-bit integer is loaded while a 16-bit integer is loaded in example
2 and a single byte is loaded into the register in example 3.
Note also that the right hand (ASCII strings) field remains constant
in all 3 examples.
I've never seen this issue on a Big Endian machine, but I'm surprised
that it still occurs this late in time on Little Endian machines.
xxx at yyyyyy:~$ lsb_release -rd
Description: Ubuntu 10.04.3 LTS
Release: 10.04
xxx at yyyyyy:~$ apt-cache policy coreutils
coreutils:
Installed: 7.4-2ubuntu3
Candidate: 7.4-2ubuntu3
Version table:
*** 7.4-2ubuntu3 0
500 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages
100 /var/lib/dpkg/status
7.4-2ubuntu2 0
500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/907180/+subscriptions
More information about the foundations-bugs
mailing list