[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] gawk bug report: SIGPIPE reset not effective
From: |
arnold |
Subject: |
Re: [bug-gawk] gawk bug report: SIGPIPE reset not effective |
Date: |
Mon, 09 May 2016 04:56:09 -0600 |
User-agent: |
Heirloom mailx 12.4 7/29/08 |
Hi.
Thanks for your note. You did not include your proposed patch; please
send it on and I'll try to review.
Thanks,
Arnold
Ian Jackson <address@hidden> wrote:
> I found that gawk is leaving SIGPIPE ignored when executing
> subprocesses.
>
> (I used a glibc patch,
>
> https://bugs.debian.org/cgi-bin/bugreport.cgi?filename=glibc.diff;att=2;msg=32;bug=823460
> to discover this.)
>
> To reproduce:
> date | awk '{ system("yes | true") }'
>
> Expected output: nothing.
>
> Actual output:
> yes: standard output: Broken pipe
>
> This is because this commit
>
> http://git.savannah.gnu.org/cgit/gawk.git/commit/?id=19564e696aca506a14ceb4a08aa2b7c7988a2473
> which tried to fix this bug, did not fix occurrences of "popen" and
> "system.
>
> Attached is a rather ugly and unportable patch which fixes this in my
> tests. Problems with the patch include:
> * Calls to popen() and system() are also made on by portability
> code for EMX (whatever that is) and MinGW32; these are unfixed
> by my patch.
> * The patch rather repetitive, because:
> * It would be better to refactor the "os_setbinmode" pattern
> found at these two call sites, to hava an "os_before_child"
> and "os_after_child", or something.
>
> I thought I would bring all this to your attention and see what
> guidance you wanted to give me about a better patch, or whether you
> wanted to fix it your own way.
>
> (Bug repro'd with Debian 4.1.3+dfsg-0.1 but I doubt the version makes
> much difference.)
>
> Regards,
> Ian.