public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* libstdc++/4879: std::ofstream failing to detect out of space?
@ 2001-11-02 14:46 garsh
  0 siblings, 0 replies; 3+ messages in thread
From: garsh @ 2001-11-02 14:46 UTC (permalink / raw)
  To: gcc-gnats


>Number:         4879
>Category:       libstdc++
>Synopsis:       std::ofstream failing to detect out of space?
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 14 11:06:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     garsh@home.com
>Release:        unknown-1.0
>Organization:
>Environment:
Seen on x86 linux, redhat 6.2 & 7.1
>Description:
std::ofstream is not detecting an "out of space"
condition.  I would expect badbit to be set on the
stream, but there is no indication of any problems
in the stream.
>How-To-Repeat:
To reproduce, compile & run the following program.
     
The named file (/boot/xxx) must be in a partition with
no free space.  For my tests, I simply filled up the
/boot partition of a linux machine
(cat /dev/zero > /boot/foo) and ran this.
-----------------------------------------
#include <iostream>
#include <fstream>

int main()
{
    const char* data("this is the text for the file\n");

    std::ofstream ofs("/boot/xxx");

    for (unsigned i = 0; i < strlen(data); ++i)
    {
        ofs.put(data[i]);
    }

    ofs.close();

    if (ofs.good())
    {
        std::cout << "stream is good\n";
    }
    if (ofs.bad())
    {
        std::cout << "stream is bad\n";
    }
    if (ofs.fail())
    {
        std::cout << "stream is fail\n";
    }
    return 0;
}
----------------
     
Running this, you will see that /boot/xxx gets created as
a zero-length file, but the program prints out
"stream is good".
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: libstdc++/4879: std::ofstream failing to detect out of space?
@ 2002-03-28 14:59 bkoz
  0 siblings, 0 replies; 3+ messages in thread
From: bkoz @ 2002-03-28 14:59 UTC (permalink / raw)
  To: bkoz, garsh, gcc-bugs, gcc-prs

Synopsis: std::ofstream failing to detect out of space?

State-Changed-From-To: open->closed
State-Changed-By: bkoz
State-Changed-When: Thu Mar 28 14:59:01 2002
State-Changed-Why:
    This is now fixed. I think this got fixed with the Brad Garcia/laurel network fixes, which were staged.
    
    In any case:
    
    %a.out 
    stream is fail
    
    So I think it's fixed. If you cannot reproduce this, let me know and I'll re-open it.
    
    gcc version 3.2 20020324 (experimental)
    
    best,
    benjamin

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=4879


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: libstdc++/4879: std::ofstream failing to detect out of space?
@ 2002-01-03 20:04 bkoz
  0 siblings, 0 replies; 3+ messages in thread
From: bkoz @ 2002-01-03 20:04 UTC (permalink / raw)
  To: bkoz, garsh, gcc-bugs, gcc-prs, nobody

Synopsis: std::ofstream failing to detect out of space?

Responsible-Changed-From-To: unassigned->bkoz
Responsible-Changed-By: bkoz
Responsible-Changed-When: Thu Jan  3 20:04:48 2002
Responsible-Changed-Why:
    Mine.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=4879


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-03-28 22:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-02 14:46 libstdc++/4879: std::ofstream failing to detect out of space? garsh
2002-01-03 20:04 bkoz
2002-03-28 14:59 bkoz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).