On Tue, 20 Nov 2018 10:15:33 +0000 Jonathan de Boyne Pollard <j.deboynepollard-newsgro...@ntlworld.com> wrote: > Dmitry Bogatov: > > > Can you please elaborate, what exactly would break? > > > > Look at the way that the init-d-script script is used. It isn't used as > the interpreter of an rc script. (Your manual needs fixing to show the > correct way to invoke it, by the way.) It is invoked as: > > > #!/bin/sh > > if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then > > set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script > > fi > > > > init-d-script proceeds to source the script that sourced it. Consider > what happens if its final action is not to exit $? . The shell returns > to the original rc script, and runs the rest of it *again*. This > wouldn't be a problem if rc scripts were purely pseudo-declarative, as > it would just run some variable assignments and function definitions a > second time. But in reality people are writing rc scripts like these, > cargo-cult style:
fwiw, this is why I suggested to provide a C implementation of init-d-script which can be used as an interpreter See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=913247 I consider the usage of /usr/bin/env only a kludge and hope the maintainers of /lib/init/init-d-script do reconsider, i.e. I don't consider #913247 to be solved. Regards, Michael -- Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?
signature.asc
Description: OpenPGP digital signature