fflush(NULL) clobbers input streams

Corinna Vinschen corinna-cygwin@cygwin.com
Tue Jul 18 10:51:00 GMT 2017


On Jul 18 11:54, Corinna Vinschen wrote:
> On Jul 17 19:53, Achim Gratz wrote:
> > 
> > Perl configure for 5.22.1 on Cygwin 2.4.0 said this:
> > 
> > --8<---------------cut here---------------start------------->8---
> > Checking how to flush all pending stdio output...
> > Your fflush(NULL) works okay for output streams.
> > Let's see if it clobbers input pipes...
> > fflush(NULL) seems to behave okay with input streams.
> > --8<---------------cut here---------------end--------------->8---
> > 
> > I'm reasonably certain that the intervening Perl versions were also this
> > way, but I didn't keep the log files around unfortunately.
> > 
> > Now, using Cygwin 2.8.x to configure Perl 5.22.4 I got this instead:
> > 
> > --8<---------------cut here---------------start------------->8---
> > Checking how to flush all pending stdio output...
> > Your fflush(NULL) works okay for output streams.
> > Let's see if it clobbers input pipes...
> > Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
> > Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
> > Sigh. Flushing explicitly all the stdio streams doesn't work.
> > --8<---------------cut here---------------end--------------->8---
> > 
> > It seems that fflush is only supposed to discard buffered input data on
> > seekable files, but not pipes (per POSIX.1-2008), so this looks a
> > regression to me.
> 
> Did you try to bisect the issue?

The log doesn't indicate any obvious candidate.  We're talking about a
timeframe of 2016-01-15 - 2017-03-30 *iff* this already occurs on 2.8.0.

At least knowing the exact Cygwin version introducing the issue would
be a great help zeroing in on the culprit.

Oh, and a plain C testcase, of course...


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-apps/attachments/20170718/e49d901a/attachment.sig>


More information about the Cygwin-apps mailing list