Subject: bug#30550: closed (Re: bug#30550: zgrep over multiple files returns 1 if pattern not found in a single file even if found in other files)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 21 Feb 2018 19:32:02 +0000

Your bug report

#30550: zgrep over multiple files returns 1 if pattern not found in a single file even if found in other files

which was filed against the grep package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
30550: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=30550
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#30550: zgrep over multiple files returns 1 if pattern not found in a single file even if found in other files
From: Paul Eggert <[email-masked]>
To: David McCauley <[email-masked]>, [email-masked], [email-masked]
Date: Wed, 21 Feb 2018 11:31:47 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

On 02/20/2018 07:01 AM, David McCauley wrote:
> zgrep version: 1.5

That's pretty old. The bug should be fixed in the current zgrep version 
(1.9). See:

https://bugs.gnu.org/17760

Subject: zgrep over multiple files returns 1 if pattern not found in a single file even if found in other files
From: David McCauley <[email-masked]>
To: "[email-masked]" <[email-masked]>, "[email-masked]" <[email-masked]>
Date: Tue, 20 Feb 2018 15:01:05 +0000 (UTC)
List-Id: <debbugs-submit.debbugs.gnu.org>

grep version: 2.20zgrep version: 1.5

$cat test1hello
$cat test2goodbye
$cat test3goodbye
$cat test4goodbye
$grep "hello" test1     #works as expected
hello$echo $?0
$grep "goodbye" test1     #works as expected$echo $?1
$grep "hello" *    #works as expected. gets line from test1 and returns 0test1:hello$echo $?0
$grep "goodbye" *    #works as expected. gets lines from test2, 3, and 4 and returns 0test2:goodbyetest3:goodbyetest4:goodbye$echo $?0

despite stating zgrep works the same as grep, the return codes over multiple files are different
$zgrep "hello" test1     #works as expected
hello$echo $?0
$zgrep "goodbye" test1     #works as expected$echo $?1
$zgrep "hello" *    #does NOT work as expected. gets line from test1 and returns 1. grep states that if ANY line is found, 0 will be returned
test1:hello$echo $?1

$zgrep "goodbye" *    #does NOT work as expected. gets lines from test2, 3, and 4 and returns 1. grep states that if ANY line is found, 0 will be returned
test2:goodbyetest3:goodbyetest4:goodbye$echo $?1

$zgrep "goodbye" test2 test3 test4    #works as expected. finds pattern in all files and returns 0. bug only occurs if files exist where the pattern is not foundtest2:goodbyetest3:goodbyetest4:goodbye$echo $?0