bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Behavior of fflush with SIGPIPE on stdout [PATCH]


From: Eli Zaretskii
Subject: Re: [bug-gawk] Behavior of fflush with SIGPIPE on stdout [PATCH]
Date: Wed, 29 Mar 2017 17:43:09 +0300

> Date: Wed, 29 Mar 2017 08:36:05 -0400
> From: "Andrew J. Schorr" <address@hidden>
> Cc: address@hidden, address@hidden
> 
> On Tue, Mar 28, 2017 at 10:19:16PM +0300, Eli Zaretskii wrote:
> > Yep, just like I thought:
> > 
> >   D:\usr\eli>yes | d:\gnu\gawk-4.1.61\gawk "{ print; fflush(stdout) }" | 
> > head
> >   y
> >   y
> >   y
> >   y
> >   y
> >   y
> >   y
> >   y
> >   y
> >   y
> >   gawk: cmd. line:1: (FILENAME=- FNR=264) fatal: fflush: cannot flush 
> > standard output: Invalid argument
> >   yes: standard output: Invalid argument
> >   yes: write error
> > 
> > Which is hardly what we want.
> > 
> > This "needs work"™.
> 
> Is this using the master branch?

It's a sn apshot of the master branch which Aharon produced for me
yesterday.

> If so, it seems to imply that when fflush fails, it is not setting
> errno to EPIPE.

Yes, that's the problem: on Windows we don't get errno = EPIPE in this
case.

> Is the "fatal"
> message such a horrible result? Is this a regression from previous versions?
> Did 4.1.4 simply hang without ever detecting the write/fflush failure?

4.1.4 produces similar error messages, except that it doesn't exit the
loop, so it produces many more of them.

As to whether this result is horrible: I guess it depends on whether
we want the behavior to be more consistent across platforms.  I'd like
at least to "fix" errno in this case to be EPIPE, then we can talk
about what exit status to produce.  Does that make sense?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]