bug-gawk
[Top][All Lists]
Advanced

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

[bug-gawk] gawk bug report: SIGPIPE reset not effective


From: Ian Jackson
Subject: [bug-gawk] gawk bug report: SIGPIPE reset not effective
Date: Sun, 8 May 2016 22:27:56 +0100

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.



reply via email to

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