Bug 117008 - libstdc++ 3.2.3 does not support opening files > 2GB
libstdc++ 3.2.3 does not support opening files > 2GB
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: gcc3 (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2004-02-27 06:50 EST by Michael Doppler
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version: libstdc++34-3.4.0-2
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-05-27 11:01:27 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Michael Doppler 2004-02-27 06:50:24 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6)
Gecko/20040206 Firefox/0.8

Description of problem:
The STL filestreams (std::[io]fstream) supplied with the libstdc++
3.2.3 rpm on RedHat Enterprise Linux 3 seem to lack support for
opening files that are bigger than 2 GB.

The following test program deomonstrates this issue.

It opens a 2500MB file, once using std::ifstream::open() and another
time using the C library open() system call.

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <iostream>
#include <fstream>

int main()
    std::ifstream test( "2500MB.bin" );
    if( !test.is_open() )
        std::cout << "Open via ifstream::open() failed!" << std::endl;

    if( ::open( "2500MB.bin", O_RDONLY ) == -1 )
        std::cout << "Open via C open() failed!" << std::endl;

    return 0;

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

How reproducible:

Steps to Reproduce:
1. Compile test program: g++ -D_FILE_OFFSET_BITS=64
2. Create a file > 2GB: dd if=/dev/zero of=2500MB.bin bs=1M count=2500
on an ext3 partition
3. Call the testprogram in the directory the file was created: ./a.out

Actual Results:  std::ifstream::open() fails, C lib open() succeeds.

Expected Results:  Both open() calls succeed.

Additional info:

Curiously, when using std::ifstream::open() on the 2500MB file on a
reiserfs partition it succeeds. I don't know if this is a Bug or a
feature of that filesystem. 

Note that the C open() also succeeds when adding the O_LARGEFILE flag
and compiling the test program without the defines.
Comment 1 Suzanne Hillman 2004-03-02 16:48:54 EST
Internal RFE bug #117336 entered.
Comment 2 Jakub Jelinek 2004-05-27 11:01:27 EDT
This will be fixed in RHEL4.  It is not suitable for RHEL3, as it
needs to maintain libstdc++ ABI compatibility.

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