[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#691422: init-functions: order of arguments is not context-free



On 10/25/2012 09:53 AM, Arno Töll wrote:
> As spotted in #691365, it turns out that the pidofproc function provided in
> /lib/lsb/init-functions is not context free. Calling
> 
>     pidofproc "$DAEMON" -p $PIDFILE"
> 
> in contrast to
> 
>     pidofproc -p $PIDFILE "$DAEMON"
> 
> 
> yields different results if the file in $PIDFILE does not exist. This yields to a
> non-context-freeness which is probably not what the user calling this function
> expects.

The LSB spec for pidofproc is here:

https://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptfunc.html

It defines the command line arguments for pidofproc as your second form,
with the -p parameter first.

This is in line with a number of other commands which require that
dashed parameters come before bare arguments, and is also consistent
with the implementation of getopt(1), getopt(3), and the "getopts" shell
function in POSIX (the latter of which our script relies on for argument
parsing).

Given this, I'm inclined to mark this bug "wontfix".  But I'm willing to
be convinced otherwise.


Reply to: