[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#28105: Inconsistent exit code with --files-without-match
From: |
Paul Eggert |
Subject: |
bug#28105: Inconsistent exit code with --files-without-match |
Date: |
Sat, 22 Aug 2020 14:11:47 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
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 also used. Now
'grep -L > /dev/null' and 'grep -Lq' return opposite values.
That is indeed a bug.
I looked into this a bit further, and it turns out that when the Git folks were
told that git-grep behaved differently from GNU grep 3.1 and earlier, they
changed git-grep to match. This was around the same time we changed GNU grep to
behave more like the git-grep at the time. What a comedy of errors, huh?
Anyway, given all these issues it does seem like it's wise to revert the change.
I installed the attached patch into GNU grep master, with the goal of something
like this appearing in the next grep release. Thanks for reporting the problem.
0001-Revert-L-exit-status-change-introduced-in-grep-3.2.patch
Description: Text Data