This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libstdc++/2913

[Get raw message]

  http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=2913&database=gcc

We've done some testing and determined that the implementation
of basic_filebuf::_M_really_overflow is ignoring the return value of
_M_file->sync().  We are seeing sync() return EOF as expected during
the out-of-space condition, but since this isn't being checked and
propagated, the badbit is not getting set in basic_ios.

So this is definitely a bug in libstdc++, not in the operating system.
And it's a pretty severe bug.

Basically, we will never catch errors that occur when we attempt
to close a stream (where the close causes a final flush to occur
before actually closing the file).

pme said:

    The current default configuration passes I/O to the stdio
    fwrite(3) function; the only thing the C++ library knows
    is what fwrite(3) returns, namely, the bytes successfully
    written.  If something goes wrong (out of space), a short
    count is returned.  The C++ library tests for this
    condition (in xsputn()) and set the failbit accordingly.
    
    If the underlying filesystem doesn't do anything that would
    cause fwrite(3) to return an error, then the C++ library
    has nothing to go on.  The behavior of the OS kernel and
    its filesystem drivers also come into play.



Brad Garcia


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]