Bug 111596 - cannot write files larger then 2048MB
cannot write files larger then 2048MB
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
9
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-12-05 16:02 EST by Need Real Name
Modified: 2007-04-18 12:59 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-03 18:28:09 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 Need Real Name 2003-12-05 16:02:30 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5)
Gecko/20031007 Firebird/0.7

Description of problem:
Code that needs to write a large file (greater then 2048) fails.



Version-Release number of selected component (if applicable):
gcc-c++-2.96-113 gcc-2.96-113

How reproducible:
Always

Steps to Reproduce:
1.Compile attached sample code
2.Run code with arg > 2048
3.Code crashes when file size reaches 2048MB

This sample code works fine in RedHat 7.3 with g++ 2.96
    

Actual Results:  Error message

"File size limit exceeded"

File is not written beyond 2048MB

Expected Results:  File of correct size is written 

Additional info:

#define _FILE_OFFSET_BITS 64
#include <iostream>
#include <fstream>
using namespace std;

#include <stdlib.h>

const char* const filename = "HUGEFILE";

int main(int argc, char** argv) {
  if (argc < 2) {
    cerr << "Syntax: " << argv[0] << " <nr_of_mbytes>" << endl;
    return 1;
  }
  int n = atoi(argv[1]);
  ofstream file(filename);
  if (n <= 0) return 0;

  const int BUFSIZE = 1 << 20;
  char* buf = new char[BUFSIZE];
  while (n > 0) {
    file.write(buf, BUFSIZE);
    --n;
    if (n % 64 == 0)
      cerr << n << " MB left, writing to " << filename << endl;
  }
}
Comment 1 Jakub Jelinek 2004-10-03 18:28:09 EDT
Works just fine with gcc-c++-3.4.2-2.

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