Bug 54406 - "strings" shows incorrect offset with >2GB files
"strings" shows incorrect offset with >2GB files
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: binutils (Show other bugs)
7.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-10-06 02:12 EDT by dittrich
Modified: 2008-05-01 11:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-10-06 02:13:03 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description dittrich 2001-10-06 02:12:59 EDT
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 12:06:32 EDT
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.