Issue Details (XML | Word | Printable)

Key: STDCXX-724
Type: Bug Bug
Status: Open Open
Priority: Minor Minor
Assignee: Unassigned
Reporter: Martin Sebor
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
C++ Standard Library

SIGXFSZ in filebuf

Created: 13/Feb/08 02:52 AM   Updated: 13/Feb/08 02:52 AM
Return to search
Component/s: 27. Input/Output
Affects Version/s: 4.2.0
Fix Version/s: None

Time Tracking:
Original Estimate: 4h
Original Estimate - 4h
Remaining Estimate: 4h
Remaining Estimate - 4h
Time Spent: Not Specified
Remaining Estimate - 4h

Environment: Fedora release 8 (Werewolf)

Severity: Runtime Error


 Description  « Hide
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().

gcc's libstdc++ fails in a similar way. I filed bug 35176.

$ 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


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
No work has yet been logged on this issue.