bug#28105: Inconsistent exit code with --files-without-match

2020-08-22 Thread Paul Eggert
On 8/7/20 4:14 AM, Antonio Diaz Diaz wrote: I propose to revert this change to remain consistent with POSIX. It's not a POSIX issue, since POSIX doesn't specify -L, which means grep can do whatever it wants if you specify -L. But in GNU grep 3.2 to 3.4 -q inverts the exit status when -L is

bug#28105: Inconsistent exit code with --files-without-match

2020-08-07 Thread Antonio Diaz Diaz
Sorry for being late in the conversation, but I didn't know about this change in grep's exit status until now. On Tue, 15 Aug 2017 22:16:58 -0700 Paul Eggert wrote: The grep documentation says exit status depends on whether lines (not files) are selected, so grep is conforming to its documentat

bug#28105: Inconsistent exit code with --files-without-match

2017-08-17 Thread Paul Eggert
Thanks for the pointer. It looks to me like git-grep's behavior is better than grep's, so I installed the attached. >From 92526f7246464825c5547ceb08e01433e035c867 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 17 Aug 2017 14:15:35 -0700 Subject: [PATCH] grep: -L exits with status 0 if a

bug#28105: Inconsistent exit code with --files-without-match

2017-08-16 Thread Anthony Sottile
On Wed, Aug 16, 2017 at 5:04 PM, Paul Eggert wrote: > On 08/16/2017 03:04 PM, Anthony Sottile wrote: >> >> It was at this point that a git maintainer noticed that `git grep -L` >> and `grep -L` disagreed in exit codes (deferring my patch until the >> correct way forward on what `git grep`'s exit c

bug#28105: Inconsistent exit code with --files-without-match

2017-08-16 Thread Paul Eggert
On 08/16/2017 03:04 PM, Anthony Sottile wrote: It was at this point that a git maintainer noticed that `git grep -L` and `grep -L` disagreed in exit codes (deferring my patch until the correct way forward on what `git grep`'s exit codes should be). Thanks for the summary. Do you have a URL for t

bug#28105: Inconsistent exit code with --files-without-match

2017-08-16 Thread Anthony Sottile
On Tue, Aug 15, 2017 at 10:15 PM, Paul Eggert wrote: > Anthony Sottile wrote: >> >> # Search is for filenames not containing hi, this search is successful >> **but it exits 1** >> $ grep -L hi -- f; echo $? >> f >> 1 >> # Search is for filenames not containing hello, this search fails >> **but it

bug#28105: Inconsistent exit code with --files-without-match

2017-08-15 Thread Paul Eggert
Anthony Sottile wrote: # Search is for filenames not containing hi, this search is successful **but it exits 1** $ grep -L hi -- f; echo $? f 1 # Search is for filenames not containing hello, this search fails **but it exits 0** $ grep -L hello -- f; echo $? 0 The grep documentation says exit s

bug#28105: Inconsistent exit code with --files-without-match

2017-08-15 Thread Anthony Sottile
Given the exit code of `grep` vs. `grep -v`, I expect similar results when comparing `grep -l` and `grep -L` (`--files-with-matches` / `--files-without-match`) For at least `grep` / `grep -v` / `grep -l` when the "search" is successful, it exits `0` and when the search is unsuccessful it exits `1`