Bug 913461

Summary: yum install returns zero even though some of the packages were not installed
Product: Red Hat Enterprise Linux 7 Reporter: michal novacek <mnovacek>
Component: yumAssignee: James Antill <james.antill>
Status: CLOSED NOTABUG QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: james.antill
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-06-19 19:48:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description michal novacek 2013-02-21 09:56:54 UTC
Description of problem:
"yum -y install bash aa" will return zero even thought 'aa' is non-existant.  I
believe that zero should indicate that everything has passed correctly and not
some of the operations passed correctly as it does now. It also is not consistent with  
'yum -y install aa' correctly returning 1.

Version-Release number of selected component (if applicable):
yum-3.4.3-46.el7.noarch

How reproducible: always

Steps to Reproduce:
1. 'yum -y install aa bash'
2. echo $?
  
Actual results:
returns zero

Expected results:
returns non-zero

Additional info:
Please correct it so we can rely on yum to have installed everything he had
been told.

Comment 2 James Antill 2013-02-21 21:58:03 UTC
 This is how it's always worked, yum only complains for install/list/etc. if all the arguments fail (or it results in a depsolve failure, for install).

Comment 3 michal novacek 2013-02-25 13:00:00 UTC
I'm quite sure that it works this way since ever. What I believe is just plain wrong is that zero is returned but not all of the action has been successfully done. 

I do not agree with simply saying that it has always been like this because it is no reasen for returning zero (which says everything worked correctly) in place of returning non-zero (some or all of the things wanted to pass have failed).

Comment 4 James Antill 2013-06-19 19:48:43 UTC
 Again, backwards compatibility is meaningful ... there are a number of cases where it's useful to say:

yum install foo bar baz

...and you only want those packages that are available to be installed. This is even more problematic with other yum commands, and having yum commands act on the arguments to return value differently is not going to help anybody.

 If you really want to check are "X, Y, Z" installed/latest-version/whatever there are ways you can do that efficiently via. the command line or the API.

 If you want even simpler ways to look for specific sets of packages, maybe you could look at an RFE for passing a group of packages to "yum version"?

Comment 5 James Antill 2013-06-19 20:24:05 UTC
 I just added:

http://yum.baseurl.org/gitweb?p=yum.git;a=commitdiff;h=587b4d0f0aad4c38e0c69fadab1407171e274ce6

...and it's building in rawhide now, I think that'll do something useful for you.