[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gawk] Behavior of fflush with SIGPIPE on stdout
From: |
alexandre.ferrieux |
Subject: |
[bug-gawk] Behavior of fflush with SIGPIPE on stdout |
Date: |
Tue, 7 Mar 2017 11:42:50 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20111113 Thunderbird/8.0 |
Hi,
After a recent OS upgrade on the only machine where I do heavy awk work, I got caught by a regression dated 2013 in
gawk, namely the one about "ignored SIGPIPE".
Basically, what happens is that the ages-old unix idiom
infinite-data-source | filter | head
fails if "filter" is a post-2013 gawk using explicit fflush().
Example:
yes | awk '{print;fflush(stdout)}' | head
Of course this is a cooked example, but I guess you can imagine the real-life situations where explicit fflush() is
needed, with appropriate task-dependent granularity, for performance and interactivity.
Looking at the comments in main.c, I do not see whether this regression was
considered or not.
It rather looks like the idea of "writing to a pipe" was generally thought about in the context of additional fds
("print ... | cmd"), but that the simple, obvious case of
- gawk used as a unix filter
- stdout is a pipe
was overlooked.
I assume this is just a shallow search on my part; thanks in advance for giving pointers to the relevant discussion and
release notes announcing this regression, and the idiomatic ways to avoid it.
-Alex
PS: Note that crude versions of awk like "mawk" don't have the issue, but I
need gawk for the obvious reasons.
_________________________________________________________________________________________________________________________
Ce message et ses pieces jointes peuvent contenir des informations
confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce
message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages
electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou
falsifie. Merci.
This message and its attachments may contain confidential or privileged
information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete
this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been
modified, changed or falsified.
Thank you.
- [bug-gawk] Behavior of fflush with SIGPIPE on stdout,
alexandre.ferrieux <=
- Re: [bug-gawk] Behavior of fflush with SIGPIPE on stdout, david kerns, 2017/03/07
- Re: [bug-gawk] Behavior of fflush with SIGPIPE on stdout [PATCH], Andrew J. Schorr, 2017/03/10
- Re: [bug-gawk] Behavior of fflush with SIGPIPE on stdout [PATCH], alexandre.ferrieux, 2017/03/10
- Re: [bug-gawk] Behavior of fflush with SIGPIPE on stdout [PATCH], Andrew J. Schorr, 2017/03/10
- Re: [bug-gawk] Behavior of fflush with SIGPIPE on stdout [PATCH], Arnold Robbins, 2017/03/17
- Re: [bug-gawk] Behavior of fflush with SIGPIPE on stdout [PATCH], Andrew J. Schorr, 2017/03/17
- Re: [bug-gawk] Behavior of fflush with SIGPIPE on stdout [PATCH], arnold, 2017/03/19
- Re: [bug-gawk] Behavior of fflush with SIGPIPE on stdout [PATCH], Andrew J. Schorr, 2017/03/19
- Re: [bug-gawk] Behavior of fflush with SIGPIPE on stdout [PATCH], arnold, 2017/03/20
- Re: [bug-gawk] Behavior of fflush with SIGPIPE on stdout [PATCH], Andrew J. Schorr, 2017/03/21