Bug 523233

Summary: initscript collected problems LSB-compilant
Product: [Fedora] Fedora Reporter: Jan Ščotka <jscotka>
Component: dovecotAssignee: Michal Hlavinka <mhlavink>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: mhlavink
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-17 15:41:17 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 Jan Ščotka 2009-09-14 14:33:32 UTC
Description of problem:
there are few problems with initscript of service:
based on document:
https://fedoraproject.org/wiki/Packaging/SysVInitScript

* /var/run/cyrus-imapd.pid doesn't exist

* insufficient rights, there should be returncode 4
# su testuserqa -c "service $SERVICE restart"; echo $?
now: 0 
expected: 4

* there arent implemented LSB compilant functions which are requred:
 usage


* nonexist function should have returncode 3:
# service $SERVICE noexistop; echo $?
now: 1
expected: 3

Comment 1 Jan Ščotka 2009-09-15 14:43:35 UTC
:: [   LOG    ] :: >>>>>>>>> service start
:: [   PASS   ] ::  Service must start without problem
:: [   PASS   ] ::  Then Status command 
:: [   PASS   ] ::  Already started service 
:: [   PASS   ] ::  Again status command 
:: [   LOG    ] :: >>>>>>>>> service restart
:: [   PASS   ] ::  Restarting of service
:: [   PASS   ] ::  Status command 
:: [   LOG    ] :: >>>>>>>>> service stop
:: [   PASS   ] ::  Stopping service 
:: [   PASS   ] ::  Status of stopped service 
:: [   PASS   ] ::  Stopping service again 
:: [   PASS   ] ::  Status of stopped service 
:: [   LOG    ] :: >>>>>>>>> pid file
:: [   FAIL   ] :: File /var/run/dovecot.pid should exist 
:: [   PASS   ] :: Running 'echo 666666 > /var/run/dovecot.pid'
:: [   FAIL   ] ::  Existing pid file, but service not started  (Expected 1, got 3)
:: [   LOG    ] :: >>>>>>>>> lock file
:: [   PASS   ] :: File /var/lock/subsys/dovecot should exist
:: [   PASS   ] :: Running 'touch /var/lock/subsys/dovecot'
:: [   PASS   ] ::  Existing lock file, but service not started 
:: [   LOG    ] :: >>>>>>>>> insufficient rights
:: [   PASS   ] ::  Starting service for restarting under nonpriv user 
:: [   FAIL   ] :: Insufficient rights, restarting resrvice under nonprivileged user must fail (Expected 4, got 0)
:: [   LOG    ] :: >>>>>>>>> operations
:: [   PASS   ] ::  Service have to implement start function 
:: [   PASS   ] ::  Service have to implement restart function 
:: [   PASS   ] ::  Service have to implement status function 
:: [   FAIL   ] ::  Service have to implement usage function  (Expected 0, got 2)
:: [   PASS   ] ::  Service have to implement condrestart function 
:: [   PASS   ] ::  Service have to implement try-restart function 
:: [   PASS   ] ::  Service have to implement reload function 
:: [   PASS   ] ::  Service have to implement force-reload function 
:: [   LOG    ] :: >>>>>>>>> nonexist operations
:: [   PASS   ] ::  Testing proper return code when nonexisting function
:: [   LOG    ] :: >>>>>>>>> invalid arguments
:: [   PASS   ] ::  When no arguments added to service, it must fail with proper return code

Comment 2 Michal Hlavinka 2009-09-17 13:42:07 UTC
(In reply to comment #1)
> :: [   FAIL   ] :: File /var/run/dovecot.pid should exist 

dovecot uses /var/run/dovecot/master.pid

this file is heavily referenced from documentation and even dovecot sources and plugins

-> I'm not going to change this.

> :: [   PASS   ] :: Running 'echo 666666 > /var/run/dovecot.pid'
> :: [   FAIL   ] ::  Existing pid file, but service not started  (Expected 1,
> got 3)

your test used wrong pid file, if you use correct file /var/run/dovecot/master.pid , it will return 1 as expected

-> this works

> :: [   FAIL   ] :: Insufficient rights, restarting resrvice under nonprivileged
> user must fail (Expected 4, got 0)

-> fixed

> :: [   FAIL   ] ::  Service have to implement usage function  (Expected 0, got
> 2)

-> fixed

Comment 3 Jan Ščotka 2009-09-17 13:53:31 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > :: [   FAIL   ] :: File /var/run/dovecot.pid should exist 
> 
> dovecot uses /var/run/dovecot/master.pid
> 
> this file is heavily referenced from documentation and even dovecot sources and
> plugins
> 
> -> I'm not going to change this.

Okay, why not, but almost all service use exact path /var/run/nameofservice.pid
There is option to add second pid file used mainly for services. because then it will be predictable.


> 
> > :: [   PASS   ] :: Running 'echo 666666 > /var/run/dovecot.pid'
> > :: [   FAIL   ] ::  Existing pid file, but service not started  (Expected 1,
> > got 3)
> 
> your test used wrong pid file, if you use correct file
> /var/run/dovecot/master.pid , it will return 1 as expected

Yep, viz above.
It is not clear have pid file in other dir than other services do. 

> 
> -> this works
> 
> > :: [   FAIL   ] :: Insufficient rights, restarting resrvice under nonprivileged
> > user must fail (Expected 4, got 0)
> 
> -> fixed

Thanks

> 
> > :: [   FAIL   ] ::  Service have to implement usage function  (Expected 0, got
> > 2)
> 
> -> fixed  

Thanks

There is needed more strict rules in LSB pseudo-standard. Now it is based on anyone interpretation.