Bug 51727 - rpm 4.0.2 returns 0 status despite error message
Summary: rpm 4.0.2 returns 0 status despite error message
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm
Version: 6.1
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2001-08-14 14:23 UTC by Tim Freeman
Modified: 2007-04-18 16:35 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2001-08-14 14:23:11 UTC

Attachments (Terms of Use)

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

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