[Pkg-sysvinit-devel] Bug#339955: debian-policy: do not require /etc/init.d/*.sh scripts to be sourced
Kel Modderman
kel at otaku42.de
Mon Feb 2 19:13:58 UTC 2009
Package: debian-policy
Version: 3.8.0.1
Severity: wishlist
Hi Debian Policy maintainers,
It is the opinion of myself and Petter Reinholdtsen, maintainers of the
sysvinit package, that the last sentence of §9.3.1 of policy is no longer
relevant and should be removed:
"""Also, if the script name ends in .sh, the script will be sourced in
runlevel S rather than being run in a forked subprocess, but will be
explicitly run by sh in all other runlevels."""
The reasons for which it should be removed are:
* /etc/init.d/rc has not supported this for an extremely long time, probably
never, because the system would be unbootable due to .sh scripts calling
'exit' [0, 1].
* the reason why .sh scripts should be sourced is not clear. A popular
theory is that it was an optimisation to avoid forking shells and reduce
boot time [2]. It may have been an interface to allow scripts to "set
an environment variable which would propogate through to subsequent
scripts" [3].
These days, sourcing .sh scripts instead of executing them is not so
much of an optimisation; we have a lightweight shell dash which can be
used as /bin/sh and has been measured to improve boot time [4]. startpar
has been hacked on to work better with the Debian boot system and we hope
to use it for parrallel execution of initscripts in the future without
contradicting policy (it a C program which uses execlp() to execute
scripts).
Passing enviroment variables around by sourcing .sh scripts is not a
supported interface: .sh scripts have not been sourced for years
and nobody has cared.
* it would be nice to clean up /etc/init.d/rc in the absence of this
requirement. Trying to support the sourcing of /etc/init.d/*.sh
scripts makes the code much uglier to maintain.
Thanks, Kel.
[0] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=339955#59
[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=339955#120
[2] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=339955#20
[3] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=339955#15
[4] http://initscripts-ng.alioth.debian.org/soc2006-bootsystem/bootcharts.html
More information about the Pkg-sysvinit-devel
mailing list