Bug 53994 - hexdump -s fails on file with size >2Gb
Summary: hexdump -s fails on file with size >2Gb
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: util-linux   
(Show other bugs)
Version: 7.1
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Elliot Lee
QA Contact: Ben Levenson
Depends On:
TreeView+ depends on / blocked
Reported: 2001-09-25 08:32 UTC by santini
Modified: 2007-03-27 03:48 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-01-04 18:54:34 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description santini 2001-09-25 08:32:05 UTC
Bad: if you run hexdump -s on a file larger than 2Gb it returns 
"Value too large for defined data type." instead of working correctly.

Good: if you run it without -s it begins to hexdump (but I didn't 
wait till it pass the 2Gb limit in dumping).

Reproduce it with:

1. Find a file larger than 2Gb (let call it foo.big)

2. hexdump -s 1 foo.big
3. it says

hexdump: foo.big: Value too large for defined data type.

Here is the (last lines of) stracing the above:   

open("foo.big", O_RDONLY|O_LARGEFILE) = 0
fstat64(0, {st_mode=S_IFREG|0640, st_size=3659968591, ...}) = 0
write(2, "hexdump: foo.big: Value to"..., 63hexdump: foo.big: Value too
large for defined data type.) = 63

Comment 1 santini 2001-09-25 09:16:14 UTC
Now I've recompiled it (starting from util-linux-2.10s-13.7.src.rpm) and adding
-D_FILE_OFFSET_BITS=64 to the CFLAGS in make_include as generated by rpm -ba.

Now the errors are:

hexdump: foo.big: File too large
hexdump: stdin: Bad file descriptor.

The (relevant) strace is

open("foo.big", O_RDONLY) = -1 EFBIG (File too large)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No
such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such
file or directory)write(2, "hexdump: /mnt/Big/ubicrawler.tes"..., 77hexdump:
foo.big: File too large) = 77
_llseek(-1, 1, 0xbffff4b0, SEEK_SET)    = -1 EBADF (Bad file descriptor)
write(2, "hexdump: stdin: Bad file descrip"..., 37hexdump: stdin: Bad file
descriptor.) = 37
_exit(1)                                = ?

Comment 2 Elliot Lee 2002-03-08 19:02:39 UTC
It works for me with util-linux-2.11f-17 on an x86 box. I think some additional
flags (-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE) were added to make things work
nicely. Please reopen this bug if you still have problems with the 7.2 errata

Note You need to log in before you can comment on or make changes to this bug.