bug-gawk
[Top][All Lists]
Advanced

[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.




reply via email to

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