Bug#921558: lsb-base: killproc does not pass name parameter to start-stop-daemon
Didier 'OdyX' Raboud <[email protected]> Wed, 13 Mar 2019 21:07:27 +0100
| Newsgroups | gmane.linux.debian.devel.lsb |
|---|---|
| Organization | Debian - The Universal OS |
| Message-ID | <1873596.HRUgZlF24f__10673.6006376863$1552508491$gmane$org@odyx.org> |
Hi there Andreas,
Le mercredi, 6 f=C3=A9vrier 2019, 20.20:54 h CET Andreas Metzler a =C3=A9cr=
it :
> there is a logic error in /lib/lsb/init-functions's killproc:
>=20
> base=3D${1##*/}
> if [ ! $pidfile ]; then
> name_param=3D"--name $base --pidfile /var/run/$base.pid"
> else
> name_param=3D"--pidfile $pidfile"
> fi
This is there since 3.2-20, 10+ years ago:
In 2.0-5 (2005-01-30):
if [ ! $pidfile ]; then
pidfile=3D/var/run/$(basename "$1").pid
fi
In 3.0-11 (2005-10-27):
base=3D$(basename "$1")
if [ ! $pidfile ]; then
pidfile=3D/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=3D${1##*/}
if [ ! $pidfile ]; then
pidfile=3D/var/run/$base.pid
name_param=3D"--name $base"
fi
In 3.2-16 (2008-08-01):
"Fix behavior of killproc and pidofproc when no pidfile is passed in."
base=3D${1##*/}
if [ ! $pidfile ]; then
name_param=3D"--name $base"
else
name_param=3D"--pidfile $pidfile"
fi
In 3.2-20 (2008-08-18):
"pidofproc now also checks for /var/run/$base.pid if -p is not specified,=20
fixing conformance with the spec."
base=3D${1##*/}
if [ ! $pidfile ]; then
name_param=3D"--name $base --pidfile /var/run/$base.pid"
else
name_param=3D"--pidfile $pidfile"
fi
I'm just pointing out that it's an old bug; and that makes me uncomfortable=
to=20
fix it, especially for a shell script installed on virtually _all_ Debian=20
hosts.
> The if clause checks for nonempty $pidfile instead of nonempty $base to
> decide whether --name is used.
>=20
> Also --pidfile $pidfile is always used, even when $pidfile is empty.
=E2=80=A6 but arguably, the code is bogus. :-)
(Will answer to other points down the thread)
Cheers,
OdyX