[Bug libstdc++/35763] std::cout loses whole blocks of output if interrupted by signal without SA_RESTART
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35763 --- Comment #5 from Johannes Schaub --- We also have this bug and it took us several days to find the cause. Testcase by my colleague attached. Perhaps this should fire an assertion if it is hard to fix efficiently, instead of simply letting things go wrong unnoticed.
[Bug libstdc++/35763] std::cout loses whole blocks of output if interrupted by signal without SA_RESTART
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35763 Johannes Schaub changed: What|Removed |Added CC||schaub.johannes@googlemail. ||com --- Comment #4 from Johannes Schaub --- Created attachment 31309 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31309&action=edit Reproduction of badbit
[Bug libstdc++/35763] std::cout loses whole blocks of output if interrupted by signal without SA_RESTART
--- Comment #3 from pcarlini at suse dot de 2008-03-30 09:24 --- This is tightly coupled to libstdc++/35353: in the current design, when sync_with_stdio is false (by default), the stream is non-converting and synced with C stdio, simply forwards to stdio functions. Unfortunately, the fix is not forthcoming, there are very serious performance implications, and binary compatibility issues (which probably can be solve only by breaking the ABI). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35763
[Bug libstdc++/35763] std::cout loses whole blocks of output if interrupted by signal without SA_RESTART
--- Comment #2 from zlynx at acm dot org 2008-03-30 03:46 --- Created an attachment (id=15399) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15399&action=view) test program, build: g++ timer-test.cc -lrt -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35763
[Bug libstdc++/35763] std::cout loses whole blocks of output if interrupted by signal without SA_RESTART
--- Comment #1 from zlynx at acm dot org 2008-03-30 03:43 --- Forgot to mention, I filed a bug for fwrite too: http://sources.redhat.com/bugzilla/show_bug.cgi?id=5998 Until they fix that (if they do) it will be useless to check fwrite's return value since you can't know how many bytes were written. I think the fix would be to use write directly or to use the file operations (which do seem to use write directly and check for EINTR returns) on fd 0. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35763