Bug#1003609: readlink: invalid option -- 'b' in /lib/lsb/init-functions.d/40-systemd
Peter Palfrader
weasel at debian.org
Wed Jan 12 15:04:16 GMT 2022
Package: systemd
Version: 247.3-6
Severity: normal
Tags: patch
Hi!
/lib/lsb/init-functions.d/40-systemd calls
readlink -f "$executable"
which causes warnings if an executable starts with -, like in "-bash" when
/lib/lsb/init-functions is sourced from a login shell.
] root at yukon:~# . /lib/lsb/init-functions
] readlink: invalid option -- 'b'
] Try 'readlink --help' for more information.
] root at yukon:~#
This happens for instance with the slony init script:
| adns002:~# grep 'init-functions ' /etc/init.d/slony1
| su -c ". /lib/lsb/init-functions ; umask 027 ; start_daemon -p $(pidfile $1) $DAEMON -f $(conffile $1) -p $(pidfile $1) >>$(logfile $1) 2>&1 </dev/null &" - postgres
And causes warnings in journald:
} Jan 12 16:02:16 adns002 slony1[41162]: Starting Slony-I daemon: con_prov_slony_dns_2022
} Jan 12 16:02:16 adns002 slony1[41189]: readlink: invalid option -- 'b'
} Jan 12 16:02:16 adns002 slony1[41189]: Try 'readlink --help' for more information.
} Jan 12 16:02:16 adns002 su[41178]: pam_unix(su-l:session): session closed for user postgres
} Jan 12 16:02:16 adns002 slony1[41162]: .
} Jan 12 16:02:16 adns002 systemd[1]: Started LSB: start Slony-I daemon.
Please change /lib/lsb/init-functions.d/40-systemd to fix this.
--- pape/40-systemd 2022-01-12 11:49:22.367583829 +0100
+++ /lib/lsb/init-functions.d/40-systemd 2022-01-12 11:50:27.011956293 +0100
@@ -26,7 +26,7 @@
# Redirect SysV init scripts when executed by the user
if [ $PPID -ne 1 ] && [ -z "${SYSTEMCTL_SKIP_REDIRECT:-}" ]; then
- case $(readlink -f "$executable") in
+ case $(readlink -f -- "$executable") in
/etc/init.d/*)
# If the state is not-found, this might be a newly installed SysV init
# script where systemd-sysv-generator has not been run yet.
--
| .''`. ** Debian **
Peter Palfrader | : :' : The universal
https://www.palfrader.org/ | `. `' Operating System
| `- https://www.debian.org/
More information about the Pkg-systemd-maintainers
mailing list