[PATCH 2/5] Fix the return value of vlog* functions when VERBOSE=no

Trek trek00 at inbox.ru
Wed Apr 27 08:56:36 BST 2022


On Wed, 27 Apr 2022 07:44:52 +0100
Mark Hindley <mark at hindley.org.uk> wrote:

> On Tue, Apr 26, 2022 at 11:48:11PM +0200, Trek wrote:
> > To improve compatibility between the logging functions and the
> > vlog* ones, the return value should be consistent with their
> > counterparts, regardless of the VERBOSE value.  
> 
> Can you provide an example case when this matters?

Actually not, as vlog* functions were introduced specifically for
init-d-script. But if those functions are intended as a replacement of
the lsb ones, they should mimic the same interface.

The typical usage of log_end_msg is like this one in init-d-script
version debian/2.93-8:

    do_reload_sigusr1() {
        log_daemon_msg "Reloading $DESC configuration files" "$NAME"
        start-stop-daemon --oknodo --stop --signal 1 --quiet \
          --pidfile "$PIDFILE" --exec "$DAEMON"
        log_end_msg $?
    }

where log_end_msg gets the return value of start-stop-daemon and then it
returns the same value, so do_reload_sigusr1 returns the same value of
start-stop-daemon.

Without this patch, when we call vlog_end_msg 1, if VERBOSE is "no" it
returns 0, otherwise it returns 1. But it should always returns the
first argument, that is 1.

Trek



More information about the Debian-init-diversity mailing list