Bug 541402

Summary: uuidd initscript lsb compliance
Product: [Fedora] Fedora Reporter: Yulia Kopkova <ykopkova>
Component: util-linux-ngAssignee: Karel Zak <kzak>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 12CC: dkovalsk, kzak
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: util-linux-ng-2.17-4.fc13 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 565888 (view as bug list) Environment:
Last Closed: 2010-06-14 09:53:14 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:
Bug Depends On:    
Bug Blocks: 521669    

Description Yulia Kopkova 2009-11-25 19:18:24 UTC
Description of problem:

According to https://fedoraproject.org/wiki/Packaging/SysVInitScript uuidd
component init scripts have some lsb compliance issues:

1. Init script should return code "4" if restarting service under
nonprivileged user:
# su testuserqa -c "service uuidd restart"; echo $?
Stopping uuidd:                                            [FAILED]
rm: cannot remove `/var/lock/subsys/uuidd': Permission denied
Starting uuidd: 
touch: cannot touch `/var/lock/subsys/uuidd': Permission denied
0
now: 0 
expected: 4 

2. try-restart action should be supported

3. nonexist action should have return code "2":
# service uuidd nonexist ; echo $?
Usage: /etc/init.d/uuidd {start|stop|status|restart|reload|force-reload|condrestart}
1
now: 1
expected: 2


4. Initscript should return code "1", when program is dead and /var/run pid
file exists:
# service uuidd start
Starting uuidd:                                            [  OK  ]
# ps ax | grep uuidd
23905 ?        Ss     0:00 /usr/sbin/uuidd
# kill -11 23905
# ls -l /var/run/uuidd/*.pid
-rw-r--r--. 1 uuidd uuidd 9 2009-11-25 20:03 /var/run/uuidd/uuidd.pid
# service uuidd status ; echo $?
uuidd dead but subsys locked  ->> it should be "uuidd dead but pid file
exists"
2
now: 2
expected: 1

5. Initscript should return code "0" on status action for started service:
# service uuidd start
Starting uuidd:                                            [  OK  ]
# service uuidd status ; echo $?
uuidd dead but subsys locked
2
now: 2
expected: 0

Comment 2 Yulia Kopkova 2010-02-16 11:56:49 UTC
Karel, I have tried util-linux-ng-2.17-3.fc13.x86_64

# service uuidd start ; echo $?
4
# touch /var/lock/subsys/uuidd
# service uuidd start ; echo $?
Starting uuidd:                                            [  OK  ]
0

Service does not start cause of this
start() {
         ...
        [ -w $LOCKFILE ] || exit 4

$LOCKFILE is removed with stop()

Comment 3 Yulia Kopkova 2010-02-16 12:04:58 UTC
Initscript should return code "1", when program is dead and /var/run pid
file exists:
# service uuidd start ; echo $?
0

# ls -l /var/run/uuidd/uuidd.pid 
-rw-r--r--. 1 uuidd uuidd 9 Feb 16 12:57 /var/run/uuidd/uuidd.pid

# ps ax | grep uuidd
29852 ?        Ss     0:00 /usr/sbin/uuidd
29901 pts/2    S+     0:00 grep uuidd

# kill -11 29852

# ls -l /var/run/uuidd/uuidd.pid 
-rw-r--r--. 1 uuidd uuidd 9 Feb 16 12:57 /var/run/uuidd/uuidd.pid

# service uuidd status ; echo $? <--- If pid file exists it should return 1 not 2
uuidd dead but subsys locked
2

# touch /var/run/uuidd.pid 
# service uuidd status ; echo $?
uuidd dead but pid file exists
1

Looks like it tries to check if /var/run/uuidd.pid exists 
not /var/run/uuidd/uuidd.pid

Comment 4 Karel Zak 2010-02-16 14:34:56 UTC
(In reply to comment #2)
> Service does not start cause of this
> start() {
>          ...
>         [ -w $LOCKFILE ] || exit 4
> 
> $LOCKFILE is removed with stop()    

Fixed. Sorry, stupid bug.

(In reply to comment #3)
> Initscript should return code "1", when program is dead and /var/run pid
> file exists:
[...]
> # service uuidd status ; echo $? <--- If pid file exists it should return 1 not
> 2
> uuidd dead but subsys locked
> 2
> 
> # touch /var/run/uuidd.pid 
> # service uuidd status ; echo $?
> uuidd dead but pid file exists
> 1
> 
> Looks like it tries to check if /var/run/uuidd.pid exists 
> not /var/run/uuidd/uuidd.pid    

Yes, it's necessary to call 'status' function from /etc/init.d/functions with option "-p $pidfile" if the pid file is not directly in the /var/run directory.

Fixed.

It would be nice to add a check() function (for example from cupsd initscript) and the hint about "status -p $pidfile" to the template at
https://fedoraproject.org/wiki/Packaging/SysVInitScript

Comment 5 Yulia Kopkova 2010-02-16 14:51:00 UTC
Verified bugs are fixed with util-linux-ng-2.17-4.fc13.x86_64

Thank you, Karel