Bug 54406 - "strings" shows incorrect offset with >2GB files
Summary: "strings" shows incorrect offset with >2GB files
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: binutils
Version: 7.1
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-10-06 06:12 UTC by dittrich
Modified: 2008-05-01 15:38 UTC (History)
0 users

(edit)
Clone Of:
(edit)
Last Closed: 2001-10-06 06:13:03 UTC


Attachments (Terms of Use)

Description dittrich 2001-10-06 06:12:59 UTC
Description of Problem:

"strings" used with "--radix=x" and large file (>2GB) does
not include enough characters in output for 64 bit offset.
It only includes 8 hex digits (32 bits), when it needs several
more to accomodate the largest files in an ext2 file system.

Version-Release number of selected component (if applicable):

# rpm -qf `which strings`
binutils-2.10.91.0.2-3

How Reproducible:

Very.

Steps to Reproduce:
1. # dd if=/dev/zero bs=1024 count=5000000 of=bigfile
   # ls -l bigfile
-rw-r--r--    1 root     root     5120000000 Oct  5 12:54 bigfile
2. # xxd bigfile | tail
312cff60:0000 0000 0000 0000 0000 0000 0000 0000  ................
312cff70:0000 0000 0000 0000 0000 0000 0000 0000  ................
312cff80:0000 0000 0000 0000 0000 0000 0000 0000  ................
312cff90:0000 0000 0000 0000 0000 0000 0000 0000  ................
312cffa0:0000 0000 0000 0000 0000 0000 0000 0000  ................
312cffb0:0000 0000 0000 0000 0000 0000 0000 0000  ................
312cffc0:0000 0000 0000 0000 0000 0000 0000 0000  ................
312cffd0:0000 0000 0000 0000 0000 0000 0000 0000  ................
312cffe0:0000 0000 0000 0000 0000 0000 0000 0000  ................
312cfff0:0000 0000 0000 0000 0000 0000 0000 0000  ................

Actual Results:

0x312cffff == 825032703

Expected Results:

0x1312CFFFF == 5119999999

Additional Information:

# cat foo.c
#include <stdio.h>
long long int f = 5120000000;
int main(void) {
        fprintf(stdout, "%12.12llX\n", f-1);
        exit(0);
}
# make foo
# ./foo
0001312CFFFF

Comment 1 Jakub Jelinek 2001-10-11 16:06:32 UTC
Should be fixed in binutils-2.11.92.0.5-2.
There were few more problems with huge files: strings.c was not compiled
with -D_FILE_OFFSET_BITS=64 (thus you couldn't run strings on a huge file
as argument at all), end it printed only what fit into host long.
While doing this, I have speed up strings by 50% on large files by using
unlocked stdio.


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