Feature #5485
closedservice-utils.inc/service_control_stop() needs some checks before claiming success
0%
Description
This is a follow-up to #5468 - this just shouldn't claim "$service has been stopped" without any checking, it says the same even in cases where no attempt to do anything has been done because the code path did not find any usable way to attempt stopping that particular service. E.g., doing something like s_process_running($foo) before spitting out the message seems like an easy way to me for most cases.
https://github.com/pfsense/pfsense/blob/master/src/etc/inc/service-utils.inc#L730
Updated by Jim Thompson about 9 years ago
- Tracker changed from Bug to Feature
- Status changed from New to Rejected
stop_service() (https://github.com/pfsense/pfsense/blob/master/src/etc/inc/service-utils.inc#L119)
calls the service stop routine, if defined.
If not defined, it runs "killall servicename"
(https://github.com/pfsense/pfsense/blob/master/src/etc/inc/service-utils.inc#L142)
This obviates your "no attempt to do anything has been done". If root can't kill it, what sense does it make to report same?
If you want this fixed, resubmit it with a test case.
Updated by Kill Bill about 9 years ago
I am not expecting something to be killed when there's no code to get that done or when root cannot kill it... What I'm expecting is that it won't report success no matter what. (As for the code you linked - that's my patch actually, merged for #5468 ~2 days ago) so I'm well aware of that. Plus, it deals with package-installed services only.
It is actually useful to check whether something was killed or not - for one, it does not mislead users with bogus information, additionally it also helps to find bugs in the stop_service() code.