[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/4] grep: don't say "write error" over and over
From: |
Paul Eggert |
Subject: |
Re: [PATCH 1/4] grep: don't say "write error" over and over |
Date: |
Wed, 08 Feb 2012 11:22:29 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0 |
Thanks for reviewing that. What a mess!
An odd thing is that the patch *did* fix things for
Fedora 15. Maybe its shell is busted? But that's a
different matter.
I think we can address this particular problem without
relying on a new coreutils feature, though the feature
you mention does sound useful for other reasons.
I pushed this:
tests: work portably even if SIGPIPE is ignored
* tests/epipe: Don't rely on "trap - PIPE"; that's not portable.
Problem reported by Eric Blake in
<http://lists.gnu.org/archive/html/bug-grep/2012-02/msg00017.html>.
Also, use "ls -al" rather than "echo", in case "echo" is done by a
buggy shell that ignores write errors. And close grep's fd 3, as
a sanity check.
diff --git a/tests/epipe b/tests/epipe
index f9cb3f6..1d9ef05 100755
--- a/tests/epipe
+++ b/tests/epipe
@@ -6,8 +6,8 @@
if
(
- (trap - PIPE; while echo x; do :; done) 3>&- |
- (trap '' PIPE; exec grep x 2>&3) |
+ while ls -al; do :; done 3>&- |
+ (trap '' PIPE; exec grep . 2>&3 3>&-) |
:
) 3>&1 | (
read line1 && echo >&2 "$line1" &&