Bug 58815 - RETVAL is not set correctly in all /etc/init.d/* scripts
Summary: RETVAL is not set correctly in all /etc/init.d/* scripts
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts
Version: 7.2
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-01-25 03:36 UTC by Oliver Schulze L.
Modified: 2014-03-17 02:25 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-09-29 19:33:15 UTC
Embargoed:


Attachments (Terms of Use)

Description Oliver Schulze L. 2002-01-25 03:36:16 UTC
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 17:09:47 UTC
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 19:33:15 UTC
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-10 03:51:11 UTC
ok, will do
Thanks


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