Bug#822753: /lib/init/init-d-script: exit 0 at end of script prevents all other exit codes
Michael Biebl
biebl at debian.org
Tue Nov 20 20:25:08 GMT 2018
On Tue, 20 Nov 2018 10:15:33 +0000 Jonathan de Boyne Pollard
<J.deBoynePollard-newsgroups at 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?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://www.chiark.greenend.org.uk/pipermail/debian-init-diversity/attachments/20181120/c9ed53d8/attachment.sig>
More information about the Debian-init-diversity
mailing list