[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] fatal: print to "standard output" failed (Broken pipe)
From: |
Aharon Robbins |
Subject: |
Re: [bug-gawk] fatal: print to "standard output" failed (Broken pipe) |
Date: |
Thu, 31 Oct 2013 21:15:20 +0200 |
User-agent: |
Heirloom mailx 12.5 6/20/10 |
Hi.
> Date: Thu, 31 Oct 2013 16:58:57 +0100
> From: Hermann Peifer <address@hidden>
> To: address@hidden
> Subject: [bug-gawk] fatal: print to "standard output" failed (Broken pipe)
>
> Hi again,
>
> The error message "fatal: print to "standard output" failed (Broken
> pipe)" continues to appear (sometimes). It looks to me that the error
> message occurs more often and more consistently with growing file sizes,
> see below.
>
> I tested with gawk from git, both under 64-bit Linux and Mac OS X.
>
> Hermann
Here's a patch to try. It fixes it for me under GNU/Linux.
Arnold
-------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index 3798a5f..ac6c9da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-10-31 Arnold D. Robbins <address@hidden>
+
+ * builtin.c (efwrite): Ignore EPIPE on stdout if write error.
+ Thanks to Hermann Peifer for helping root this one out.
+
2013-10-22 Arnold D. Robbins <address@hidden>
Revise error messages when writing to standard output or standard
diff --git a/builtin.c b/builtin.c
index 9258ea6..f558fc9 100644
--- a/builtin.c
+++ b/builtin.c
@@ -125,9 +125,11 @@ efwrite(const void *ptr,
return;
wrerror:
- fatal(_("%s to \"%s\" failed (%s)"), from,
- rp ? rp->value : _("standard output"),
- errno ? strerror(errno) : _("reason unknown"));
+ /* don't fatal on EPIPE to stdout */
+ if (fp != stdout || errno != EPIPE)
+ fatal(_("%s to \"%s\" failed (%s)"), from,
+ rp ? rp->value : _("standard output"),
+ errno ? strerror(errno) : _("reason unknown"));
}
/* do_exp --- exponential function */