From unknown Sat Jun 21 10:13:04 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#30550 <30550@debbugs.gnu.org> To: bug#30550 <30550@debbugs.gnu.org> Subject: Status: zgrep over multiple files returns 1 if pattern not found in a single file even if found in other files Reply-To: bug#30550 <30550@debbugs.gnu.org> Date: Sat, 21 Jun 2025 17:13:04 +0000 retitle 30550 zgrep over multiple files returns 1 if pattern not found in a= single file even if found in other files reassign 30550 grep submitter 30550 David McCauley severity 30550 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 20 11:36:32 2018 Received: (at submit) by debbugs.gnu.org; 20 Feb 2018 16:36:32 +0000 Received: from localhost ([127.0.0.1]:53092 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eoAu8-000548-Eq for submit@debbugs.gnu.org; Tue, 20 Feb 2018 11:36:32 -0500 Received: from eggs.gnu.org ([208.118.235.92]:43291) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eo9QG-0000rn-CW for submit@debbugs.gnu.org; Tue, 20 Feb 2018 10:01:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eo9Q6-0005IF-1D for submit@debbugs.gnu.org; Tue, 20 Feb 2018 10:01:30 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:51050) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eo9Q5-0005Hv-U3 for submit@debbugs.gnu.org; Tue, 20 Feb 2018 10:01:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eo9Px-0006oZ-Ap for bug-grep@gnu.org; Tue, 20 Feb 2018 10:01:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eo9Pp-0005Cv-LL for bug-grep@gnu.org; Tue, 20 Feb 2018 10:01:17 -0500 Received: from sonic307-3.consmr.mail.bf2.yahoo.com ([74.6.134.42]:38331) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eo9Pp-0005Cg-H5 for bug-grep@gnu.org; Tue, 20 Feb 2018 10:01:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ymail.com; s=s2048; t=1519138868; bh=bbAWIyHN1Wlniar1IEOyK32hRkDCOPlm3XCpJ0Ybl4s=; h=Date:From:To:Subject:References:From:Subject; b=XsyQkUSqq3E+CZ8xdXaXaZdnFftjFVV11D1CBwd6Q12vgmjub0aXtQd6EPOFxfmN0HK2EdxvTLhqMI4BhaJGwCIl91KZR2BhpghXvYW0MRTQ4KE4OoYDXPF+sjoonIJTk8N6xrfHCIKnvm4RdyVPUKkq0XOLek3JRkAmsg0D2yGLwOPR456tQDOdt2WZ1pspfqywYMkLvrHD42hcHn3AW+WgWTJedI8IQOBAFM3DZfhZHL7J/+3ItlDNTTXAbUQhQOvJntTeyujGMOUewEVQZ1UB4/4zRpT9znIpvGz7uorsrODvAVE6N019nvgEcpkp5EIw8s5HTj5NZ6/dJSkCbg== X-YMail-OSG: W88ou8EVM1kvJRbR7_ULDtjUjXpPkeYQsZsKaWOstX7mAjL753NgDb2CUHhe_nU dupKsBBzq_QGk0X4kmLqiOAbuWk16ovUp6XdJyhZNBWEICPh9GkDuZ.3A7yDv_8sE4v9MgA7t7.7 UujpMbkpUlO8v6OXL3.n2FQzL5yJ7oy8ZaGJ4BOqAQB0_V3rIRmh8KlJqUcUIkDsVm2e7cz0gojK fCA6Mi2Uwf50tv89dZp39ps1tGKmKIvRyABnGmMORw5BT9bMUttwzWDgLQT6vYKacGNB9szSydDD _E_t5dy4De_i2yixtkQ7UFq9uY1sk6Gg_hgiU8Sr2EJ2RFhkqeNqnUV7ZZUprOUAbfsbtJzO9kFb 1y5.6318mN8n4QA_J9vzulbAU2U9CRAMAxhLcQkTdRKYs1rdQ9FZaNAzGHGR_jbgeuNj4Ru4kWT7 Z7TfiCc0nhb2.RsgJxmmgJOltHBlu4x861ZJ07QSlCwA9O52EoybbLZ.cF3HjvHW5Pv.E2g-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic307.consmr.mail.bf2.yahoo.com with HTTP; Tue, 20 Feb 2018 15:01:08 +0000 Date: Tue, 20 Feb 2018 15:01:05 +0000 (UTC) From: David McCauley To: "bug-grep@gnu.org" , "charles@comm.polymtl.ca" Message-ID: <1388339002.1984902.1519138865883@mail.yahoo.com> Subject: zgrep over multiple files returns 1 if pattern not found in a single file even if found in other files MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1984899_1903484564.1519138865881" References: <1388339002.1984902.1519138865883.ref@mail.yahoo.com> X-Mailer: WebService/1.1.11419 YMailNorrin Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0 Content-Length: 4142 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.3 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 20 Feb 2018 11:36:30 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.3 (----) ------=_Part_1984899_1903484564.1519138865881 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable grep version: 2.20zgrep version: 1.5 $cat test1hello $cat test2goodbye $cat test3goodbye $cat test4goodbye $grep "hello" test1=C2=A0=C2=A0=C2=A0=C2=A0 #works as expected hello$echo $?0 $grep "goodbye" test1=C2=A0=C2=A0=C2=A0=C2=A0 #works as expected$echo $?1 $grep "hello" *=C2=A0=C2=A0=C2=A0 #works as expected. gets line from test1 = and returns 0test1:hello$echo $?0 $grep "goodbye" *=C2=A0=C2=A0=C2=A0 #works as expected. gets lines from tes= t2, 3, and 4 and returns 0test2:goodbyetest3:goodbyetest4:goodbye$echo $?0 despite stating zgrep works the same as grep, the return codes over multipl= e files are different $zgrep "hello" test1=C2=A0=C2=A0=C2=A0=C2=A0 #works as expected hello$echo $?0 $zgrep "goodbye" test1=C2=A0=C2=A0=C2=A0=C2=A0 #works as expected$echo $?1 $zgrep "hello" *=C2=A0=C2=A0=C2=A0 #does NOT work as expected. gets line fr= om test1 and returns 1. grep states that if ANY line is found, 0 will be re= turned test1:hello$echo $?1 $zgrep "goodbye" *=C2=A0=C2=A0=C2=A0 #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=C2=A0=C2=A0=C2=A0 #works as expected. fi= nds pattern in all files and returns 0. bug only occurs if files exist wher= e the pattern is not foundtest2:goodbyetest3:goodbyetest4:goodbye$echo $?0 ------=_Part_1984899_1903484564.1519138865881 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
grep version: 2.20
zgrep version: 1.5

$cat test1
hell= o

$cat test2
goodbye

$cat test3
goodbye

$cat test4
goodbye

$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 a= nd returns 0
test1:hello
$echo $?
0

$grep "goodbye" *    #works as expected. get= s lines from test2, 3, and 4 and returns 0
test2:goodbye
test3:goodbye
test4:goodbye
$echo $?
0


despite stating zgrep works the same as= grep, the return codes over multiple files are different

$zgrep "hello" test1     #works as expecte= d
hello
$echo $?
0

$zgrep "goodbye" test1     #works as expected
<= div>$echo $?
1

$zgrep "hello" *&nbs= p;   #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

$z= grep "goodbye" *    #does NOT work as expected. gets lines f= rom test2, 3, and 4 and returns 1. grep states that if ANY line is found, 0= will be returned
test2:goodbye
test3:goodbye
=
test4:goodbye
$echo $?
1

<= div>$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 found
test2:goodbye
test3= :goodbye
test4:goodbye
$echo $?
0
<= /div> ------=_Part_1984899_1903484564.1519138865881-- From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 21 14:32:01 2018 Received: (at 30550-done) by debbugs.gnu.org; 21 Feb 2018 19:32:01 +0000 Received: from localhost ([127.0.0.1]:54813 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eoa7V-0008GN-E4 for submit@debbugs.gnu.org; Wed, 21 Feb 2018 14:32:01 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:41480) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eoa7S-0008G8-72 for 30550-done@debbugs.gnu.org; Wed, 21 Feb 2018 14:31:58 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 5C10B161625; Wed, 21 Feb 2018 11:31:52 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id kgRNIwPQ4OKP; Wed, 21 Feb 2018 11:31:51 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 6954A161624; Wed, 21 Feb 2018 11:31:51 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id XQF1DjateVEo; Wed, 21 Feb 2018 11:31:51 -0800 (PST) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 4F1C216161F; Wed, 21 Feb 2018 11:31:51 -0800 (PST) Subject: Re: bug#30550: zgrep over multiple files returns 1 if pattern not found in a single file even if found in other files To: David McCauley , 30550-done@debbugs.gnu.org, charles@comm.polymtl.ca References: <1388339002.1984902.1519138865883.ref@mail.yahoo.com> <1388339002.1984902.1519138865883@mail.yahoo.com> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <51223512-d55c-f2f1-c54b-667438f529e6@cs.ucla.edu> Date: Wed, 21 Feb 2018 11:31:47 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1388339002.1984902.1519138865883@mail.yahoo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 30550-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) 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 From unknown Sat Jun 21 10:13:04 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 22 Mar 2018 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator