This is the mail archive of the
mailing list for the libstdc++ project.
RE: Information on a commit related to libstdc++/9533
- From: Pétur Runólfsson <peturr02 at ru dot is>
- To: "Paolo Carlini" <pcarlini at unitus dot it>,"Nathan Myers" <ncm-nospam at cantrip dot org>
- Cc: <libstdc++ at gcc dot gnu dot org>
- Date: Mon, 3 Mar 2003 13:18:27 -0000
- Subject: RE: Information on a commit related to libstdc++/9533
> But... regtesting we got the failure of this test ("fail bit
> was not set!"):
Here's my take on what is going on:
> // libstdc++/2913, libstdc++/4879
> // John Fardo <jfardo at laurelnetworks dot com>, Brad Garcia
> <garsh at attbi dot com>
> signal(SIGPIPE, SIG_IGN);
> if (0 != mkfifo("xxx", S_IRWXU))
> std::cerr << "failed to creat fifo" << std::endl;
> int fval = fork();
> if (fval == -1)
> std::cerr << "failed to fork" << std::endl;
> else if (fval == 0)
> std::ifstream ifs("xxx");
Here, one end of the pipe is opened for reading and then closed
again without reading anything. This allows the other end to
be opened without blocking.
> std::ofstream ofs("xxx");
Opens the write end of the pipe, then waits for two seconds, by
which time the read end should have been closed.
> * ISO/IED 14882:1998(E) 188.8.131.52.4
> * void close();
> * Effects: Calls rdbuf()->close() and, if that function fails
> * (returns a null pointer), calls setstate(failbit)...
This calls rdbuf()->close(), which calls _M_really_overflow, which
calls fwrite which should fail because the read end of the pipe
should have been closed, but since underflow was called at the
read end, the read end is still open.
> if (!(ofs.rdstate() & std::ios::failbit))
> std::cerr << "fail bit was not set!" << std::endl;