GNU bug report logs - #30550
zgrep over multiple files returns 1 if pattern not found in a single file even if found in other files

Previous Next

Package: grep;

Reported by: David McCauley <mccauley.david <at> ymail.com>

Date: Tue, 20 Feb 2018 16:37:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 30550 in the body.
You can then email your comments to 30550 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#30550; Package grep. (Tue, 20 Feb 2018 16:37:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to David McCauley <mccauley.david <at> ymail.com>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Tue, 20 Feb 2018 16:37:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: David McCauley <mccauley.david <at> ymail.com>
To: "bug-grep <at> gnu.org" <bug-grep <at> gnu.org>, 
 "charles <at> comm.polymtl.ca" <charles <at> comm.polymtl.ca>
Subject: zgrep over multiple files returns 1 if pattern not found in a
 single file even if found in other files
Date: Tue, 20 Feb 2018 15:01:05 +0000 (UTC)
[Message part 1 (text/plain, inline)]
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
[Message part 2 (text/html, inline)]

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Wed, 21 Feb 2018 19:32:02 GMT) Full text and rfc822 format available.

Notification sent to David McCauley <mccauley.david <at> ymail.com>:
bug acknowledged by developer. (Wed, 21 Feb 2018 19:32:02 GMT) Full text and rfc822 format available.

Message #10 received at 30550-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: David McCauley <mccauley.david <at> ymail.com>, 30550-done <at> debbugs.gnu.org,
 charles <at> comm.polymtl.ca
Subject: Re: bug#30550: zgrep over multiple files returns 1 if pattern not
 found in a single file even if found in other files
Date: Wed, 21 Feb 2018 11:31:47 -0800
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





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 22 Mar 2018 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 92 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.