Bug 114324

Summary: Exit code on --dry-run is 0 in case of packages are available for update
Product: Red Hat Enterprise Linux 4 Reporter: Peter Bieringer <pb>
Component: up2dateAssignee: Pradeep Kilambi <pkilambi>
Status: CLOSED WONTFIX QA Contact: Ken Reilly <kreilly>
Severity: low Docs Contact:
Priority: medium    
Version: 4.0CC: tao, tsanders
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: 2012-06-20 16:56:58 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:

Description Peter Bieringer 2004-01-26 17:41:57 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4)
Gecko/20030624

Description of problem:
In case of "up2date --dry-run" the exit code stays 0, even if some
packages are available for download

Version-Release number of selected component (if applicable):
up2date-4.2.5-1

How reproducible:
Always

Steps to Reproduce:
1. up2date --dry-run; echo $?
    

Actual Results:  # up2date --dry-run ; echo $?

Fetching package list for channel: rhel-i386-es-3...
########################################

Fetching Obsoletes list for channel: rhel-i386-es-3...

Fetching rpm headers...
########################################

Name                                    Version        Rel
----------------------------------------------------------
ethereal                                0.10.0a        0.30E.1       
     i386


Testing package set / solving RPM inter-dependencies...
########################################

Name                                    Version        Rel
----------------------------------------------------------
ethereal                                0.10.0a        0.30E.1       
     i386

0


Expected Results:  Exit code != 0

Additional info:

A different exit code would be very useful in case keeping amount of
messages low if "up2date --dry-run" output is sent per e-mail. 

Let assume following script triggered by cron:
mktemp tempfile
up2date >tempfile
if [ $? -ne 0 ]; then
 cat tempfile | mail -s "up2date causes new work for the admin"
admin
fi
rm -f tempfile

Comment 1 Suzanne Hillman 2004-01-29 21:54:37 UTC
Internal RFE bug #114597 entered. Will be considered for future releases.

Comment 2 Todd Warner 2004-08-27 00:47:06 UTC
Then it should not be in MODIFIED state. Back to ASSIGNED

Comment 3 Alex Stuck 2006-08-21 23:34:21 UTC
It's been 2 years now and the bug is still present in RHEL4....that's pretty
weak you guys. Switching distributions sounds more and more like a good idea to me.
Sorry to bitch but I've hit quite a few of those bugs that seem to survive ages
and ages and every time I encounter one RH support points me to a page like this
where I can find out that this bug first appeared in RHEL3...
Is this one really so hard to fix ? Exiting with the correct code as it is
described in the man page should be a standard and NOT a "feature". I understand
that bugs appear but 2 years and nothing ?? It's just very frustrating so here I
am venting !!!

Comment 4 David Lehman 2006-09-05 22:56:07 UTC
up2date's man page says the following about return code:

RETURN CODES
       Update Agent returns 0 on  success,  1  on
       error.


I'm not sure where your expectations came from, but the update agent is behaving
as designed.

Comment 5 Peter Bieringer 2006-09-07 06:37:38 UTC
You're right, it currently works as designed, so this is more a request for
enhancement to return a different exit code, if "--dry-run" is used and packages
are available for update.

Sure, administrators are happy about that.

BTW: yum does a better job on this issue, see here my current "check for
updates" script:


# Check for available updates

if [ -x /usr/bin/yum ]; then
        /usr/bin/yum -e 0 -d 0 check-update
fi


if [ -x /usr/sbin/up2date ]; then
        OUTPUT="`/usr/sbin/up2date --dry-run`"
        retval=$?

        if [ `echo "$OUTPUT" | grep -m 1 -A 1 "^--------" | wc -l` -gt 1 -o
$retval -ne 0 ]; then
                echo "$OUTPUT"
        fi
fi


Comment 7 Jiri Pallich 2012-06-20 16:56:58 UTC
Thank you for submitting this issue for consideration in Red Hat Enterprise Linux. The release for which you requested us to review is now End of Life. 
Please See https://access.redhat.com/support/policy/updates/errata/

If you would like Red Hat to re-consider your feature request for an active release, please re-open the request via appropriate support channels and provide additional supporting details about the importance of this issue.