Thanks for the explanation. I am using homebrew to streamline the package management on my machines. Is it going to be a new version of awk released to include this bug fix so that one can get the fix easily?
In reverse order:
- THe issue is not related to being in a VM environment or on real hardware.
- I was able to reproduce it simply by running the pipeline in an
endless loop. I then started adding prints until I was able to find
the source of the problem. Less direct than using a debugger, but it
worked.
- The bug was as follows. Gawk ignores SIGPIPE. When that's the case,
the write system call fails with an EPIPE error. Gawk checks for this
error, and if it sees it, kills itself with SIGPIPE to simulate "normal"
or "expected" or "traditional" behavior (take your pick).
In the case of EPIPE when flushing stdout/stderr right before exiting,
gawk didn't pass the EPIPE error up the call chain to the right point
to do something with it, so it just exited 1, for error.
The patch fixes that.
Thanks,
Arnold
Peng Yu <address@hidden> wrote:
> Hi Aharon, I am not familiar with the C API about PIPEs. Could you
> please help explain what the bug was and how it is fixed? Why were you
> not able to reproduce the bug? Is there anything special in a VM
> environment?
>
> On Sun, Jun 17, 2018 at 1:46 PM, <address@hidden> wrote:
> > OK. I banged on this some more and managed to track it down.
> > A fix is below. I will push this out to git shortly.
> >
> > Thanks,
> >
> > Arnold
--