SIGXFSZ in filebuf
------------------

                 Key: STDCXX-724
                 URL: https://issues.apache.org/jira/browse/STDCXX-724
             Project: C++ Standard Library
          Issue Type: Bug
          Components: 27. Input/Output
    Affects Versions: 4.2.0
         Environment: Fedora release 8 (Werewolf)
            Reporter: Martin Sebor
            Priority: Minor


The program below dies with SIGXFSZ on Linux. I don't think the standard allows 
filebuf to report errors using signals (since it describes file I/O in terms of 
C stdio), nor does a signal seem desirable in C++. We might need to suspend 
signals while calling POSIX 
[write()|http://www.opengroup.org/onlinepubs/009695399/functions/write.html].

gcc's libstdc++ fails in a similar way. I filed [bug 
35176|http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35176].

{noformat}
$ cat u.cpp && make u && ./u
#include <fstream>
#include <sys/resource.h>

int main ()
{
    rlimit rl;
    getrlimit (RLIMIT_FSIZE, &rl);

    rl.rlim_cur = 32;
    setrlimit (RLIMIT_FSIZE, &rl);

    std::filebuf fb;
    if (0 == fb.open ("testfile.text", std::ios::out))
        return -1;

    for (rlim_t i = 0; ; ++i)
        if (-1 == fb.sputc ('*'))
            break;
}
gcc -c -I/home/sebor/stdcxx/include/ansi -D_RWSTDDEBUG   -pthread 
-I/home/sebor/stdcxx/include -I/build/sebor/stdcxx-gcc-4.1.2-15D/include 
-I/home/sebor/stdcxx/tests/include  -pedantic -nostdinc++ -g   -W -Wall 
-Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long -Wcast-align   
u.cpp
gcc u.o -o u -L/build/sebor/stdcxx-gcc-4.1.2-15D/rwtest -lrwtest15D -pthread  
-L/build/sebor/stdcxx-gcc-4.1.2-15D/lib  
-Wl,-R/build/sebor/stdcxx-gcc-4.1.2-15D/lib:/build/sebor/stdcxx-gcc-4.1.2-15D/rwtest
 -lstd15D -lsupc++ -lm 
File size limit exceeded
{noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to