[Pkg-sysvinit-devel] Bug#339955: sysv-rc: /etc/init.d/*.sh should
be sourced in runlevel S
Brendan O'Dea
bod at debian.org
Sat Nov 19 22:17:24 UTC 2005
Package: sysv-rc
Version: 2.86.ds1-5
Severity: serious
Debian Policy states (§9.3.1):
"Also, if the script name ends `.sh', the script will be sourced in
runlevel `S' rather that being run in a forked subprocess, but will
be explicitly run by `sh' in all other runlevels".
This could probably be achieved with the attached patch, although there
are quite a few instances in /etc/init.d/*.sh scripts where "exit" is
called. These scripts need to be changed to use "return"* appropriately
before the behaviour is changed.
Note: I believe that "return" should work to exit from a script both
when sourced and when executed but perhaps someone with a copy of POSIX
could confirm.
--bod
--- /etc/init.d/rc.orig 2005-11-20 08:43:41.000000000 +1100
+++ /etc/init.d/rc 2005-11-20 08:55:10.000000000 +1100
@@ -37,12 +37,14 @@
action=$1
shift
scripts="$@"
+ sh=sh
+ [ S = "$runlevel" ] && sh=.
case "$CONCURRENCY" in
none)
for script in $scripts ; do
case "$script" in
*.sh)
- $debug sh "$script" $action
+ $debug $sh "$script" $action
;;
*)
$debug "$script" $action
More information about the Pkg-sysvinit-devel
mailing list