Bug 117008

Summary: libstdc++ 3.2.3 does not support opening files > 2GB
Product: Red Hat Enterprise Linux 3 Reporter: Michael Doppler <m.doppler>
Component: gcc3Assignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: tao
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libstdc++34-3.4.0-2 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-05-27 15:01:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michael Doppler 2004-02-27 11:50:24 UTC
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):
libstdc++-3.2.3-24

How reproducible:
Always

Steps to Reproduce:
1. Compile test program: g++ -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE test.cpp
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 21:48:54 UTC
Internal RFE bug #117336 entered.

Comment 2 Jakub Jelinek 2004-05-27 15:01:27 UTC
This will be fixed in RHEL4.  It is not suitable for RHEL3, as it
needs to maintain libstdc++ ABI compatibility.