Bug 54406

Summary: "strings" shows incorrect offset with >2GB files
Product: [Retired] Red Hat Linux Reporter: dittrich
Component: binutilsAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-10-06 06:13:03 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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.