Bug 114324 - Exit code on --dry-run is 0 in case of packages are available for update
Exit code on --dry-run is 0 in case of packages are available for update
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: up2date (Show other bugs)
4.0
All Linux
medium Severity low
: ---
: ---
Assigned To: Pradeep Kilambi
Ken Reilly
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-01-26 12:41 EST by Peter Bieringer
Modified: 2013-02-26 19:49 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-06-20 12:56:58 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Peter Bieringer 2004-01-26 12:41:57 EST
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@domain.example
fi
rm -f tempfile
Comment 1 Suzanne Hillman 2004-01-29 16:54:37 EST
Internal RFE bug #114597 entered. Will be considered for future releases.
Comment 2 Todd Warner 2004-08-26 20:47:06 EDT
Then it should not be in MODIFIED state. Back to ASSIGNED
Comment 3 Alex Stuck 2006-08-21 19:34:21 EDT
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 18:56:07 EDT
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 02:37:38 EDT
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 12:56:58 EDT
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.

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