Bug#921558: lsb-base: killproc does not pass name parameter to start-stop-daemon
Hi there Andreas,
Le mercredi, 6 février 2019, 20.20:54 h CET Andreas Metzler a écrit :
> there is a logic error in /lib/lsb/init-functions's killproc:
>
> base=${1##*/}
> if [ ! $pidfile ]; then
> name_param="--name $base --pidfile /var/run/$base.pid"
> else
> name_param="--pidfile $pidfile"
> fi
This is there since 3.2-20, 10+ years ago:
In 2.0-5 (2005-01-30):
if [ ! $pidfile ]; then
pidfile=/var/run/$(basename "$1").pid
fi
In 3.0-11 (2005-10-27):
base=$(basename "$1")
if [ ! $pidfile ]; then
pidfile=/var/run/$base.pid
fi
In 3.1-20 (2006-11-16):
"Don't use --name in killproc() when a pidfile is provided (Closes: #397977)"
base=${1##*/}
if [ ! $pidfile ]; then
pidfile=/var/run/$base.pid
name_param="--name $base"
fi
In 3.2-16 (2008-08-01):
"Fix behavior of killproc and pidofproc when no pidfile is passed in."
base=${1##*/}
if [ ! $pidfile ]; then
name_param="--name $base"
else
name_param="--pidfile $pidfile"
fi
In 3.2-20 (2008-08-18):
"pidofproc now also checks for /var/run/$base.pid if -p is not specified,
fixing conformance with the spec."
base=${1##*/}
if [ ! $pidfile ]; then
name_param="--name $base --pidfile /var/run/$base.pid"
else
name_param="--pidfile $pidfile"
fi
I'm just pointing out that it's an old bug; and that makes me uncomfortable to
fix it, especially for a shell script installed on virtually _all_ Debian
hosts.
> The if clause checks for nonempty $pidfile instead of nonempty $base to
> decide whether --name is used.
>
> Also --pidfile $pidfile is always used, even when $pidfile is empty.
… but arguably, the code is bogus. :-)
(Will answer to other points down the thread)
Cheers,
OdyX
Reply to: