[Top][All Lists]

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

bug#36291: od --skip-bytes reads everything from the very beginning

From: Szőts Ákos
Subject: bug#36291: od --skip-bytes reads everything from the very beginning
Date: Wed, 19 Jun 2019 10:20:10 +0200

Dear List members,

I've recently discovered that od "--skip-bytes" feature doesn't
actually seek into the file but rather it reads everything from the
very beginning until the given offset is reached.

This can be problematic in two cases:
 - when speed matters, and
 - when parts of the file is read-protected (like in the case of
/dev/mem when CONFIG_STRICT_DEVMEM=y, which is usually the case). In
this example od will reach an area in /dev/mem which is read-protected
(even for root) and will report back EPERM before it could reach the
requested, and allowed, memory area. The error report will be
misleading since the resulting EPERM is not because the requested area
is protected (as suggested by the error message) but because of the
inner mechanics of the program.

In contrary, hexdump jumps to the address directly.

You can test it by running the following two commands:
- strace hexdump --skip 0xFE000124 --length 1 /dev/sda
- strace od --skip-bytes 0xFE000124 --read-bytes 1 /dev/sda

I don't know whether this behaviour is intended but if so, could you
please expand the documentation a little bit with this additional

od version: od (GNU coreutils) 8.30, openSUSE Tumbleweed, x64

Thank you and all the best,


reply via email to

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