Bug 51727

Summary: rpm 4.0.2 returns 0 status despite error message
Product: [Retired] Red Hat Linux Reporter: Tim Freeman <tim>
Component: rpmAssignee: Jeff Johnson <jbj>
Status: CLOSED WORKSFORME QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-08-14 14:23:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Tim Freeman 2001-08-14 14:23:06 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.72 [en] (X11; U; Linux 2.2.13-tim i686; Nav)

Description of problem:
In some cases, when rpm 4.0.2 prints a verbose error message,
it returns exit status 0, which causes programs like make to 
assume that it succeeded when it did not.

How reproducible:

Steps to Reproduce:
Here's how I can reproduce the problem on my system.  Comments added
afterward are in >>><<<'s.

   [tim@fungible ~]$ rpm --target
   RPM version 4.0.2
   Copyright (C) 1998-2000 - Red Hat, Inc.
   This program may be freely redistributed under the terms of the GNU GPL
   Usage: rpm {--help}
	  rpm {--version}
	  >>>Blah, blah, blah<<<
	  rpm {--rebuilddb} [--rcfile <file>] [--dbpath <dir>]
	  rpm {--querytags}
   [tim@fungible ~]$ echo $status
   0 >>>Should have been nonzero<<<
   [tim@fungible ~]$ rpm --version
   RPM version 4.0.2
   [tim@fungible ~]$ uname -a
   Linux fungible.com 2.2.13-tim #13 Sat Apr 8 10:30:17 PDT 2000 i686

Actual Results:  Exit status 0

Expected Results:  Any other exit status.

Additional info:

Trivial bug, but also probably a trivial fix, so probably worth doing.

Comment 1 Jeff Johnson 2001-08-14 17:08:01 UTC
The exit status of rpm has always been the number of failed
operations/objects, not a boolean "bad operation" like
many programs return. In addition, --target is not actually
known to the /bin/rpm executable, it's a configurable popt alias that
execs /usr/bin/rpmbuild. That executable returns a non-zero
exit status:

bash$ rpmbuild --target || echo yeah
--target: missing argument

In fact, it looks like you have not installed the rpm-build package