Bug 104867

Summary: zgrep reports incorrect return codes when grepping /dev/null
Product: [Retired] Red Hat Linux Reporter: Reuben Thomas <rrt>
Component: gzipAssignee: Ivana Varekova <varekova>
Status: CLOSED WORKSFORME QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 9   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-12-10 12:29:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Reuben Thomas 2003-09-22 21:57:41 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; Linux i686; U) Opera 7.20  [en]

Description of problem:
When doing something like

zgrep foo /dev/null

I expect the same return code as

grep foo /dev/null

which returns 1, but I get 0.

This is because the return code of grep isn't scrutinised directly, only the 
return code of the sed command into which grep's output is piped. Oops. Not 
being a shell expert I've not yet come up with a decent fix; sorry.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. grep foo /dev/null; echo $?
2. zgrep foo /dev/null; echo $?

    

Actual Results:  1
0

Expected Results:  1
1

Additional info:

Comment 1 Ivana Varekova 2004-12-10 12:29:00 UTC
In gzip-1.3.3-13 zgrep works correctly.