[Top][All Lists]

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

[debbugs-tracker] bug#36291: closed (od --skip-bytes reads everything fr

From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#36291: closed (od --skip-bytes reads everything from the very beginning)
Date: Thu, 20 Jun 2019 01:53:01 +0000

Your message dated Wed, 19 Jun 2019 18:52:01 -0700
with message-id <address@hidden>
and subject line Re: bug#36291: od --skip-bytes reads everything from the very 
has caused the debbugs.gnu.org bug report #36291,
regarding od --skip-bytes reads everything from the very beginning
to be marked as done.

(If you believe you have received this mail in error, please contact

36291: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=36291
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 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,


--- End Message ---
--- Begin Message --- Subject: Re: bug#36291: od --skip-bytes reads everything from the very beginning Date: Wed, 19 Jun 2019 18:52:01 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0
On 6/19/19 12:42 PM, Pádraig Brady wrote:
Maybe we should relax the cases we do read() for,
and try to seek in block/character special files,
falling back to read() where that fails?

Sure, that's easy enough. I installed the attached patch and am marking this bug report as done.

Attachment: 0001-od-use-fseek-on-non-regular-files.txt
Description: Text document

--- End Message ---

reply via email to

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