[2019-05-13 12:58] Thorsten Glaser <[email protected]>
> On Mon, 13 May 2019, Dmitry Bogatov wrote:
>
> > @@ -65,5 +65,3 @@ case "$1" in
> >     exit 3
> >     ;;
> >  esac
> > -
> > -:
>
> I think this is not advisable. What this will do is
> cause the last errorlevel to be returned by the script,
> which may not be an error but simply the result of a
> test command.

Then this initscripts will always fail. Bug to fix. But actually, most
scripts have following form:

        case $1 in
                start) do_start ;;
                stop)  do_stop ;;
        # [...]
        esac

Having trailing ":" would result of ignoring result these "do_*" functions.
It is true, that some of them, unfortunately, do not thread return
value properly (ex: mountall).

This change in no way complete, but just one step in direction when exit
status of initscript is meaningful.

> Initscripts explicitly call the exit built-in utility
> in case of errors and must not use 'set -e', but even
> so, this may break some legit uses.

Not that it is good thing, but I know, that both initscripts and
lsb-base can't be used with "set -e".

What legit uses you are talking about?

> Furthermore, not erroring out seems to be the proper fallback case for
> initscripts because doing otherwise may cause the system to not boot,
> which is the greater evil.

Exit status of initscript does not affect boot process: see "startup()"
from /etc/init.d/rc (no set -e):

        startup() {
                action=$1
                shift
                scripts="$@"
                for script in $scripts ; do
                        $debug "$script" $action
                done
        }
-- 
        Note, that I send and fetch email in batch, once every 24 hours.
                 If matter is urgent, try https://t.me/kaction
                                                                             --

Reply via email to