Bug 58815 - RETVAL is not set correctly in all /etc/init.d/* scripts
RETVAL is not set correctly in all /etc/init.d/* scripts
Status: CLOSED DEFERRED
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
7.2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-01-24 22:36 EST by Oliver Schulze L.
Modified: 2014-03-16 22:25 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-09-29 15:33:15 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 Oliver Schulze L. 2002-01-24 22:36:16 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; es-ES; rv:0.9.4)
Gecko/20011128 Netscape6/6.2.1

Description of problem:
When using the 'status' parameter in the scripts in /etc/init.d/ directory, the
variable RETVAL is not set correctly.

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


How reproducible:
Always

Steps to Reproduce:
1. look at for example at /etc/init.d/httpd
2. when the 'status' parameter is passed to the script, this lines
execute:
  status)
        status $httpd
  ;;

3. the RETVAL variable is not set. The solution is:
  status)
        status $httpd
        RETVAL=$?
  ;;

	

Expected Results:  It is expected that the RETVAL variable is set corecctly with
all the parameters passed to the script.

Additional info:

Sometimes you need to know the status of a service in a script with something
like this:

service httpd status
RESULT=$?

but not always you get exact RETVAL value when using the 'status' parameter.
Comment 1 Jukka Lehti 2002-04-24 13:09:47 EDT
The proposed solution is needed for final fixing but it is not enough: some
scripts have "exit 0" in the last line, not "exit $RETVAL". In skipjack2, those
scripts are:

anacron
atalk
ip6tables
ipchains
iptables
irda
isdn
junkbuster
netfs
nfs
nfslock
postgresql
psacct
random
rawdevices
smartd

(Those can be checked by: cd /etc/init.d && grep "^exit 0" * )
Comment 2 Bill Nottingham 2005-09-29 15:33:15 EDT
Closing bugs on older, no longer supported, releases. Apologies for any lack of
response.

If this persists on a current release, such as Fedora Core 4, please open a new
bug. Note that these bugs really need to be filed against the individual
packages that contain such scripts.
Comment 3 Oliver Schulze L. 2005-10-09 23:51:11 EDT
ok, will do
Thanks

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