bug-grep
[Top][All Lists]
Advanced

[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: Mon, 13 Feb 2012 00:28:52 -0800
User-agent: Mozilla/5.0 (X11; Linux i686; rv:9.0) Gecko/20111229 Thunderbird/9.0

Thanks for reporting that; I pushed this slightly different patch:

* tests/epipe: Don't loop forever if the bug is present.
Problem reported by Jaroslav Skarvada.
---
 tests/epipe |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/tests/epipe b/tests/epipe
index 1d9ef05..3b568e3 100755
--- a/tests/epipe
+++ b/tests/epipe
@@ -5,8 +5,17 @@
 . "${srcdir=.}/init.sh"; path_prepend_ ../src
 
 if
+   # Use awk to output a bounded amount of data to the grep in question,
+   # so that the test doesn't loop forever if grep is buggy.
+   # Use an explicit /dev/null for the benefit of older (pre-POSIX) awks.
+   #
+   # Carefully close fd 3 when not needed, as a sanity check.
+   #
+   # Do not use "trap - PIPE" or "trap 'something' PIPE" here, since we may
+   # be running in an environment where SIGPIPE is ignored, and in such an
+   # environment POSIX says that "trap '' PIPE" is all we can do portably.
    (
-     while ls -al; do :; done 3>&- |
+     ${AWK-awk} 'BEGIN { for (i=0; i<1000000; i++) print i; }' /dev/null 3>&- |
      (trap '' PIPE; exec grep . 2>&3 3>&-) |
      :
    ) 3>&1 | (
-- 
1.7.6.5




reply via email to

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