grep: fix -o match with empty string (suggested by Colin Watson <cjwatson@ubuntu.com>)
function old new delta
grep_file 1216 1251 +35
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/testsuite/grep.tests b/testsuite/grep.tests
index 520a184..ffce033 100755
--- a/testsuite/grep.tests
+++ b/testsuite/grep.tests
@@ -98,5 +98,9 @@
'grep -o "[^/]*$"' \
"test\n" \
"" "/var/test\n"
+testing "grep -o does not loop forever on zero-length match" \
+ 'grep -o "" | head -n1' \
+ "" \
+ "" "test\n"
exit $FAILCOUNT