Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
4.2.0
-
None
-
None
-
Fedora release 8 (Werewolf)
-
Runtime Error
Description
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