Bug 244236

Summary: Incorrect return code
Product: Red Hat Enterprise Linux 5 Reporter: Jan Hutař <jhutar>
Component: rpmAssignee: Panu Matilainen <pmatilai>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: 5.0CC: jnovy, pmatilai, psklenar
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: 2009-01-20 20:49:21 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:
Bug Depends On: 454887    
Bug Blocks:    

Description Jan Hutař 2007-06-14 17:00:09 UTC
Description of problem:
"rpm -qp not_a_file" returns incorrect return code


Version-Release number of selected component (if applicable):
rpm-4.4.2-37.el5


How reproducible:
always


Steps to Reproduce:
1. rm -f not_a_file
2. rpm -qp not_a_file
3. echo $?


Actual results:
0


Expected results:
1


Additional info:
I tried on RHEL-4 and it is OK (returns 1). On Fedora Development rpm returns 0 
too.

Comment 1 Jeff Johnson 2007-06-15 07:31:04 UTC
Reproduced.

Comment 2 Panu Matilainen 2007-06-15 11:09:33 UTC
Yup.. rpmgiNext() stops the iteration on errors and doesn't differentiate the
error case vs normal end of iteration, making accurate error reporting
impossible  AFAICT unless api or at least rpmgiNext() return semantics are changed.

Comment 3 Jeff Johnson 2007-06-16 02:42:41 UTC
The semantics will be changed this weekend ;-)

Thanks for 
    changeset 6020:	7db24f0e47a5
btw

Comment 4 Jan Hutař 2007-06-21 15:01:28 UTC
Hi,
just noticed this (on x86_64 system where are no *.s390 packages):

$ rpm -q libbonobo.s390
$ echo $?
0

But libbonobo i386 & x86_64 packages are installed:

$ rpm -q libbonobo
libbonobo-2.16.0-1.fc6
libbonobo-2.16.0-1.fc6

Probably this is relevant to this bug?

Comment 5 Jeff Johnson 2007-06-21 17:29:10 UTC
Actually, your example in #4 is a different flaw, fixed in other ways quite some
time ago in rpm-4.4.9, and recently in 4.4.2.1 as well.

Comment 6 Denise Dumas 2008-07-16 14:17:39 UTC
The RPM rebase in 5.3 / Fedora 9 includes a fix for this issue 

Comment 7 RHEL Program Management 2008-07-16 14:31:31 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 12 errata-xmlrpc 2009-01-20 20:49:21 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-0079.html