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: Andrew J. Schorr
Subject: Re: [bug-gawk] Behavior of fflush with SIGPIPE on stdout [PATCH]
Date: Fri, 24 Mar 2017 20:16:09 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Mar 23, 2017 at 01:36:40PM -0600, address@hidden wrote:
> --- a/builtin.c
> +++ b/builtin.c
> @@ -131,14 +131,18 @@ wrerror:
>  #endif
>       /* die silently on EPIPE to stdout */
>       if (fp == stdout && errno == EPIPE)
> -             gawk_exit(EXIT_FATAL);
> +             gawk_exit(EXIT_SUCCESS);        // a la SIGPIPE

By the way, I don't understand this. Why is it exiting successfully
when it catches a SIGPIPE? As far as I can tell, that's not normal.
For example:

bash-4.2$ set -o pipefail
bash-4.2$ head -1 /etc/services && echo SUCCESS
rtmp                     1/ddp
SUCCESS
bash-4.2$ cat /etc/services | head -1 && echo SUCCESS
rtmp                     1/ddp
bash-4.2$ grep . /etc/services | head -1 && echo SUCCESS
rtmp                     1/ddp
bash-4.2$ /bin/gawk 1 /etc/services | head -1 && echo SUCCESS
rtmp                     1/ddp
bash-4.2$ 

But after applying your patch:

bash-4.2$ ./gawk 1 /etc/services | head -1 && echo SUCCESS
rtmp                     1/ddp
SUCCESS
bash-4.2$ 

Why should gawk exit successfully in that situation?

Regards,
Andy



reply via email to

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