Bug 104867 - zgrep reports incorrect return codes when grepping /dev/null
Summary: zgrep reports incorrect return codes when grepping /dev/null
Status: CLOSED WORKSFORME
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gzip   
(Show other bugs)
Version: 9
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Ivana Varekova
QA Contact: Ben Levenson
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-09-22 21:57 UTC by Reuben Thomas
Modified: 2007-04-18 16:57 UTC (History)
0 users

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: ---


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.