GNU bug report logs - #36291
od --skip-bytes reads everything from the very beginning

Previous Next

Package: coreutils;

Reported by: Szőts Ákos <szotsaki <at> gmail.com>

Date: Wed, 19 Jun 2019 13:27:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Szőts Ákos <szotsaki <at> gmail.com>
To: 36291 <at> debbugs.gnu.org
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
information?

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

Thank you and all the best,

Ákos




This bug report was last modified 5 years and 337 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.