[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#220000: libstdc++5: largefile support (LFS) missing

Package: libstdc++5
Version: 1:3.3.2-1
Severity: normal

In libstdc++5-3.3.2 large file support has disappeared (with respect to 

C++ applications that manipulate large files, recompiled with g++-3.3,
might cause massive data corruption, unless they carefully test streams
for goodness before reading/writing.

The gcc team has fixed the bug, and the fix will ship with the 3.4
release.  See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8610 for

Some code to show the bug:

# build a large file that actually occupies only a few disk blocks

$ echo 12 > large_file
$ dd if=/dev/zero of=large_file bs=1k count=1 seek=3000k conv=notrunc

# make C++ code for reading it:

$ cat > testlfs.cc <<EOF
#include <fstream>
#include <iostream>

int main() {
    int i = -1;
    std::ifstream f("large_file");
    std::cout << "File is good? " << f.good() << std::endl;
    if ( f.good() ) f >> i;
    std::cout << "Value of i? " << i << std::endl;

# try different libraries:

$ g++-3.3  -Wall -D_FILE_OFFSET_BITS=64 testlfs.cc -o testlfs-3; ./testlfs-3
File is good? 0
Value of i? -1

$ g++-2.95 -Wall -D_FILE_OFFSET_BITS=64 testlfs.cc -o testlfs-2; ./testlfs-2
File is good? 1
Value of i? 12

-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux bonacci 2.4.22-1-686 #6 Sat Oct 4 14:09:08 EST 2003 i686

Versions of packages libstdc++5 depends on:
ii  gcc-3.3-base                  1:3.3.2-1  The GNU Compiler Collection (base 
ii  libc6                         2.3.2-9    GNU C Library: Shared libraries an
ii  libgcc1                       1:3.3.2-1  GCC support library

-- no debconf information

Reply to: