From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7747 invoked by alias); 14 Nov 2001 19:06:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 7722 invoked by uid 71); 14 Nov 2001 19:06:01 -0000 Resent-Date: 14 Nov 2001 19:06:01 -0000 Resent-Message-ID: <20011114190601.7721.qmail@sourceware.cygnus.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, garsh@home.com Received:(qmail 7243 invoked by uid 61); 14 Nov 2001 19:04:49 -0000 Message-Id:<20011114190449.7238.qmail@sourceware.cygnus.com> Date: Fri, 02 Nov 2001 14:46:00 -0000 From: garsh@home.com Reply-To: garsh@home.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.2 (1.1.1.1.2.21) Subject: libstdc++/4879: std::ofstream failing to detect out of space? X-SW-Source: 2001-11/txt/msg00075.txt.bz2 List-Id: >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 #include 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: