Bug#931719: 40-systemd: line 11: 1: unbound variable when sourcing /lib/lsb/init-functions with $1 unset
Michael Biebl
biebl at debian.org
Wed Jul 10 15:59:57 BST 2019
Am 09.07.19 um 17:11 schrieb Thomas Baetzler:
> Package: systemd
> Version: 241-5
> Severity: normal
> Tags: patch
>
> Dear Maintainer,
>
> After upgrading to Debian 10 we noticed a slightly different behaviour
> in /lib/lsb/init-functions.d/40-systemd which caused one of our scripts
> to break and which also causes some /etc/init.d files like /etc/init.d/mysql
> to no longer to display their help text when calling them without a parameter.
>
> The root cause are accesses to the $1 and $2 variables without checking
> if they are defined beforehand. When running code using "set -u", this
> causes the above mentioned error.
>
> I've outlined this very simple fix which bypasses all further tests if
> $1 and so on are undefined.
>
> $ diff -C 9 40-systemd.orig 40-systemd
> *** 40-systemd.orig 2019-05-24 22:58:59.000000000 +0200
> --- 40-systemd 2019-07-09 16:40:39.642678140 +0200
> ***************
> *** 1,18 ****
> --- 1,21 ----
> # -*-Shell-script-*-
> # /lib/lsb/init-functions
>
> _use_systemctl=0
> if [ -d /run/systemd/system ]; then
>
> if [ -n "${__init_d_script_name:-}" ]; then # scripts run
> with new init-d-script
> executable="$__init_d_script_name"
> argument="$1"
> + elif [ $# -eq 0 ] ; then
> + executable="$0"
> + argument=""
> elif [ "${0##*/}" = "init-d-script" ] ||
> [ "${0##*/}" = "${1##*/}" ]; then # scripts run with
> old init-d-script
> executable="$1"
> argument="$2"
> else # plain old scripts
> executable="$0"
> argument="$1"
> fi
Mert, since this basically your code, could you have a look at this.
--
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20190710/bdd4e3a1/attachment.sig>
More information about the Pkg-systemd-maintainers
mailing list