This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
Re: _IO_unbuffer_all corrupts parent process's buffers
- To: Andreas Jaeger <aj@arthur.rhein-neckar.de>
- Subject: Re: _IO_unbuffer_all corrupts parent process's buffers
- From: Tuomas Heino <tbittih@xgw.fi>
- Date: Sat, 22 Aug 1998 16:26:24 +0300 (EET DST)
- cc: "H. J. Lu" <hjl@gnu.org>, drepper@cygnus.com, libc-hacker@cygnus.com
On 22 Aug 1998, Andreas Jaeger wrote:
>
> Hi Tuomas,
>
> HJ Lu is trying to look into the bug report you've send us:
> >Number: 673
> >Synopsis: _IO_unbuffer_all corrupts parent process's buffers
>
> He has some problems with your testcase. Please send him directly a
> complete testcase. I'm appending his message for details.
>
Well I'm kinda busy nowadays but I'll try to do something tomorrow...
meanwhile I've been using this kinda patch for genops.c to make these old
libc5:ish programs work with glibc2 too...
--- /usr/src/glibc-2.0.7pre3/libio/genops.c Fri Apr 18 02:21:30 1997
+++ ../fork_debug_local/genops.c.fixed Sat Aug 22 16:12:17 1998
@@ -619,12 +619,17 @@
_IO_OVERFLOW (fp, EOF);
}
+/*
+ * 1998-06-22 / Tuomas Heino <tbittih@pal.xgw.fi>:
+ * _IO_SETBUF (fp, NULL,0) breaks parent process's input buffers
+ * ... only _IO_cleanup seems to be calling unbuffer_all ... let's
rename it
+ */
void
-DEFUN_VOID(_IO_unbuffer_all)
+DEFUN_VOID(_IO_unbuffer_all_except_input)
{
_IO_FILE *fp;
for (fp = _IO_list_all; fp != NULL; fp = fp->_chain)
- if (! (fp->_flags & _IO_UNBUFFERED))
+ if (! (fp->_flags & (_IO_UNBUFFERED|_IO_NO_WRITES)))
_IO_SETBUF (fp, NULL, 0);
}
@@ -640,7 +645,7 @@
The following will make the standard streambufs be unbuffered,
which forces any output from late destructors to be written out. */
- _IO_unbuffer_all ();
+ _IO_unbuffer_all_except_input ();
}
void
... the symlink stuff is there just to make overriding genops.c easier
and the #include "exit.h" isn't needed in simple.c - the problem was
child's exit() corrupting parent's input stream positions... I'm in a
hurry now but I think I'll look at this thing again tomorrow ;)