grep-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grep branch, master, updated. v3.3-16-g268cae4


From: Paul Eggert
Subject: grep branch, master, updated. v3.3-16-g268cae4
Date: Sat, 12 Oct 2019 21:31:59 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grep".

The branch, master has been updated
       via  268cae478d4d1126c69efd2dcd77e9bc94cf08ba (commit)
      from  cbf55dfc4c224fb0f918fcd526e105ecc4022c78 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=268cae478d4d1126c69efd2dcd77e9bc94cf08ba


commit 268cae478d4d1126c69efd2dcd77e9bc94cf08ba
Author: Paul Eggert <address@hidden>
Date:   Sat Oct 12 18:31:04 2019 -0700

    grep: fix ‘grep -L ... >/dev/null’ bug
    
    Problem reported by Adam Sampson (Bug#37716).
    * NEWS: Mention this.
    * src/grep.c (grepdesc): Don’t assume that stdout being /dev/null
    means list_files == LISTFILES_NONE.
    (main): Do not change list_files merely because stdout is /dev/null.
    * tests/skip-read: Test for this bug.

diff --git a/NEWS b/NEWS
index 5cb33cd..9ce65b3 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,12 @@ GNU grep NEWS                                    -*- outline 
-*-
 
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
+** Bug fixes
+
+  The exit status of 'grep -L' is no longer incorrect when standard
+  output is /dev/null.
+  [Bug#37716 introduced in grep 3.2]
+
 ** Build-related
 
   The build procedure no longer relies on any already-built src/grep
diff --git a/src/grep.c b/src/grep.c
index 4b6b465..6f35f26 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -1864,7 +1864,7 @@ grepdesc (int desc, bool command_line)
 
   status = !count == !(list_files == LISTFILES_NONMATCHING);
 
-  if (list_files == LISTFILES_NONE)
+  if (list_files == LISTFILES_NONE || dev_null_output)
     finalize_input (desc, &st, ineof);
   else if (status == 0)
     {
@@ -2827,7 +2827,7 @@ main (int argc, char **argv)
 
   /* POSIX says -c, -l and -q are mutually exclusive.  In this
      implementation, -q overrides -l and -L, which in turn override -c.  */
-  if (exit_on_match | dev_null_output)
+  if (exit_on_match)
     list_files = LISTFILES_NONE;
   if ((exit_on_match | dev_null_output) || list_files != LISTFILES_NONE)
     {
diff --git a/tests/skip-read b/tests/skip-read
index 3c32c48..2a17334 100755
--- a/tests/skip-read
+++ b/tests/skip-read
@@ -17,6 +17,7 @@ for opts in '-m0 y' '-f /dev/null' '-v ""'; do
     done
     eval grep -L $opts $matcher /dev/null > out || fail=1
     compare exp out || fail=1
+    eval grep -L $opts $matcher /dev/null > /dev/null || fail=1
   done
 done
 

-----------------------------------------------------------------------

Summary of changes:
 NEWS            | 6 ++++++
 src/grep.c      | 4 ++--
 tests/skip-read | 1 +
 3 files changed, 9 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
grep



reply via email to

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