I were just working on this bug, when Chris sent his "done" email. I
think we came to the same conclusion  (see my patch at the end of my
mail), based on the LSB specification. I'm just posting this now,
because I can't see Chris' exact implementation yet, while I am quite
sure that mine will work:

This is what I found for the function in question
(http://refspecs.freestandards.org/LSB_3.2.0/LSB-Core-generic/LSB-Core-generic.html#INISCRPTFUNC):

--- snip ---
The start_daemon, killproc and pidofproc functions shall use the
following algorithm for determining the status and the process
identifiers of the specified program.
1.
If the -p pidfile option is specified, and the named pidfile exists, a
single line at the start of the pidfile shall be read. If this line
contains one or more numeric values, separated by spaces, these values
shall be used. If the -p pidfile option is specified and the named
pidfile does not exist, the functions shall assume that the daemon is
not running.
2.
Otherwise, /var/run/basename.pid shall be read in a similar fashion.
If this contains one or more numeric values on the first line, these
values shall be used. Optionally, implementations may use unspecified
additional methods to locate the process identifiers required.
--- snap ---


The pidofproc function first works on the pidfile (either the
specified one or /var/run/basename.pid) if it is a readable file.

If the pidfile is not a readable file we get to the problematic code
of this bugreport. There we set the status depending whether the
pidfile was specified or not. If it was specified we are entitled by
the LSB specification to say the daemon is not running. If it was not
specified we can try other ways to get the daemon status - I think the
latter was intended to be done in the problematic code (therefore WITH
the "!" that was removed in order to close #545896).

Therefore I suggest to revert the changes from 3.2-24 and add new code:

94c94,98
<     if [ -x /bin/pidof -a "$specified" ]; then
---
>     if [ "$specified" ]; then
>         return 3 # pidfile is specified and the named pidfile does not
>                  # exist, assume that the daemon is not running.
>     fi
>     if [ -x /bin/pidof -a ! "$specified" ]; then


This may be simplified to

94c94,97
<     if [ -x /bin/pidof -a "$specified" ]; then
---
>     if [ "$specified" ]; then
>         return 3 # pidfile is specified and the named pidfile does not
>                  # exist, assume that the daemon is not running.
>     elif [ -x /bin/pidof ]; then



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to