Bug 988887 - lm_sensors init script doesn't return 3 on status when stopped
lm_sensors init script doesn't return 3 on status when stopped
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: lm_sensors (Show other bugs)
6.5
All Linux
low Severity low
: rc
: ---
Assigned To: Martin Sehnoutka
William Gomeringer
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-26 11:42 EDT by John Brier
Modified: 2016-08-17 03:41 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-08-17 03:41:52 EDT
Type: Bug
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 John Brier 2013-07-26 11:42:00 EDT
Description of problem:

# service lm_sensors stop
Stopping lm_sensors: [  OK  ]
# echo $?
0

https://fedoraproject.org/wiki/Packaging:SysVInitScript?rd=Packaging/SysVInitScript#Exit_Codes_for_the_Status_Action

if it's stopped it should return 3, not 0 

If this is expected or unique because lm_sensors technically isn't a service but just a script to load/unload modules, please confirm or clarify.

Version-Release number of selected component (if applicable):
lm_sensors-3.1.1-17.el6.x86_64


How reproducible:
100 %

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

I saw in Bug 575757 Comment 10 a suggestion to stop testing lm_sensors init script since upstream dropped it in favor of the sensord init script, but I don't see that reflected in F18 and from what I understand the scripts serve unique purposes, sensord being used to log data on sensor information regularly.
Comment 2 Jaromír Cápík 2013-07-26 12:22:11 EDT
Hello John.

The zero exitcode is correct. Non-zero exitcodes are only returned when you ask for status.

Try this:

service lm_sensors stop
service lm_sensors status

You should get 3 ...

Please, check that and let me know.

Thanks,
Jaromir.
Comment 3 John Brier 2013-07-26 12:52:25 EDT
(In reply to Jaromír Cápík from comment #2)
> Hello John.
> 
> The zero exitcode is correct. Non-zero exitcodes are only returned when you
> ask for status.
> 
> Try this:
> 
> service lm_sensors stop
> service lm_sensors status
> 
> You should get 3 ...
> 
> Please, check that and let me know.
> 
> Thanks,
> Jaromir.

oops. I didn't do my example right.

# service lm_sensors stop
Stopping lm_sensors: [  OK  ]
# service lm_sensors status
acpitz-virtual-0
Adapter: Virtual device
temp1:       +30.0°C  (crit = +105.0°C)                  
temp2:       +30.0°C  (crit = +105.0°C)                  

# echo $?
0
Comment 4 Jaromír Cápík 2013-07-26 13:27:02 EDT
Ok ... now it really seems to be a problem of the init script.
The problem only appears in some cases as it depends on the sensors available on the testing hardware.
The init script needs to be redesigned. It doesn't check for the status of sensor modules, it simply checks for the success of the sensors command. But as some of the sensors might work even without modules, the sensors command can return zero status even when all the modules defined in /etc/sysconfig/lm_sensors file are unloaded.
It's questionable if that can still be considered a running service or not.
In fact the only purpose of the init script is to load the modules. So, if we look at the init script as if it was a module loader only, then it doesn't work correctly, because it returns 0 even when all the modules loaded with service lm_sensors start are unloaded.
Comment 5 John Brier 2013-07-26 14:49:00 EDT
In Bug 575757 Comment 0 the following issues were pointed out, which still exist in lm_sensors-3.1.1-17.el6.x86_64

=== 1 ===
:: [   FAIL   ] :: Running 'grep -i "usage.*force-reload" /etc/init.d/lm_sensors' (Expected 0, got 1)
	echo "Usage: $0 {start|stop|status|restart|reload|condrestart}"

-> Add force-reload action even if it would be same as 'restart'.

=== 2 ===
Usage: /etc/init.d/lm_sensors {start|stop|status|restart|reload|condrestart}
:: [   FAIL   ] :: Running 'service lm_sensors' (Expected 2, got 3)

-> Running with invalid argument (such as blank one) should exit with exit code = 2 not 3. See https://fedoraproject.org/wiki/Packaging/SysVInitScript#Exit_Codes_for_non-Status_Actions

=== 3 ===
:: [   PASS   ] :: Running 'touch /var/lock/subsys/lm_sensors'
No sensors found!
Make sure you loaded all the kernel drivers you need.
Try sensors-detect to find out which these are.
:: [   FAIL   ] :: Running 'service lm_sensors status' (Expected 2, got 3)

-> It should say, e.g: "lm_sensors dead but subsys locked" and exit with ec=2.


Since lm_sensors isn't a real service I'm not sure if the third issue is something we should check for. Should we?
Comment 7 RHEL Product and Program Management 2013-10-13 19:20:10 EDT
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.
Comment 10 Tomáš Hozza 2016-08-17 03:41:52 EDT
Red Hat Enterprise Linux version 6 is entering the Production 2 phase of its lifetime and this bug doesn't meet the criteria for it, i.e. only high severity issues will be fixed. Please see https://access.redhat.com/support/policy/updates/errata/ for further information.

This issue is not being tracked for newer RHEL, because init scripts are not used any more.

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