Bug 462812

Summary: [5.3] Init scripts shall ensure that they will behave sensibly with stop when not running
Product: Red Hat Enterprise Linux 5 Reporter: Qian Cai <qcai>
Component: kexec-toolsAssignee: Neil Horman <nhorman>
Status: CLOSED NOTABUG QA Contact: Martin Jenner <mjenner>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.2Keywords: Reopened
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-09-22 00:20:43 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 Qian Cai 2008-09-19 02:27:40 UTC
Description of problem:
From LSB specification,

"Init scripts shall ensure that they will behave sensibly if invoked with start when the service is already running, or with stop when not running, and that they do not kill similarly-named user processes."

http://refspecs.linux-foundation.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html

However, kexec-tools init scripts do not,

# service kdump stop
Stopping kdump:[  OK  ]
# service kdump stop
Stopping kdump:[  OK  ]


Version-Release number of selected component (if applicable):
kexec-tools-1.102pre-21.el5

How reproducible:
always

Comment 1 Qian Cai 2008-09-19 02:29:48 UTC
Propose it for 5.3 exception. It should be a fairly simple fix.

Comment 2 Neil Horman 2008-09-19 15:22:30 UTC
wait a second...This is NOTABUG
 

from http://refspecs.linux-foundation.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html

For all other init-script actions, the init script shall return an exit status of zero if the action was successful. Otherwise, the exit status shall be non-zero, as defined below. In addition to straightforward success, the following situations are also to be considered successful:

 restarting a service (instead of reloading it) with the force-reload argument
 running start on a service already running
 running stop on a service already stopped or not running

We already stopped, so the stop action reports success, as per the spec.

Comment 3 Qian Cai 2008-09-21 03:09:34 UTC
(In reply to comment #2)
> wait a second...This is NOTABUG
> 
> 
> from
> http://refspecs.linux-foundation.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
> 
> For all other init-script actions, the init script shall return an exit status
> of zero if the action was successful. Otherwise, the exit status shall be
> non-zero, as defined below. In addition to straightforward success, the
> following situations are also to be considered successful:
> 

I believe this is talking about the exit code. Looking at other daemons,

[root@walsinh ~]# /etc/init.d/nfs start
Starting NFS services:                                     [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
[root@walsinh ~]# /etc/init.d/nfs stop
Shutting down NFS mountd:                                  [  OK  ]
Shutting down NFS daemon:                                  [  OK  ]
Shutting down NFS services:                                [  OK  ]
[root@walsinh ~]# /etc/init.d/nfs stop
Shutting down NFS mountd:                                  [FAILED]
Shutting down NFS daemon:                                  [FAILED]
Shutting down NFS services:                                [FAILED]
[root@walsinh ~]# echo $?
0

[root@walsinh ~]# /etc/init.d/httpd start
Starting httpd:                                            [  OK  ]
[root@walsinh ~]# /etc/init.d/httpd stop
Stopping httpd:                                            [  OK  ]
[root@walsinh ~]# /etc/init.d/httpd stop
Stopping httpd:                                            [FAILED]
[root@walsinh ~]# echo $?
0

They look like behaving sensibly when the service is with stop when not running.

Comment 4 Neil Horman 2008-09-22 00:20:43 UTC
I think you're really spliting hairs here on what is implied in the word 'sensibly'.  The fact that other daemons report failure when stopping an already stopped service but exit with a success exit code is confusing and rather not sensible.  Regardless, the fact that we successfully stop when kexec wasn't running to begin with still makes perfectly good sense.  After stopping the service the kdump kernel is removed from the kernels reserved memory and unavailable, weather or not it was before.  This is NOTABUG