[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#710559: lintian: init.d-script-call-internal-API contradicts /etc/init.d/skeleton



retitle 710559 lintian: init.d-script-call-internal-API should document replacement (remove checks for $VERBOSE and use log_* functions)
clone 710559 -1
reassign -1 initscripts
retitle -1 initscripts: Update /lib/lsb/init-functions log_* to check $VERBOSE, and update /etc/init.d/skeleton accordingly
thanks

On Fri, May 31, 2013 at 03:19:37PM -0700, Russ Allbery wrote:
> Josh Triplett <josh@joshtriplett.org> writes:
> 
> > /etc/init.d/skeleton is wrong; only sysvinit's own internal scripts
> > should use vars.sh directly.  Other scripts should source
> > /lib/lsb/init-functions and use the log_* functions.
> 
> The code in question does use the log_* functions:
> 
> case "$1" in
>   start)
>         [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
>         do_start
>         case "$?" in
>                 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
>                 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
>         esac
>         ;;
> 
> and so forth.  I don't see a substitute interface that does this, which is
> part of why I'm confused -- the log_* functions do not check $VERBOSE so
> far as I can tell.

How very odd, I thought that log_* handled verbosity internally.  By
contrast to the above, for instance, /etc/init.d/cups calls
log_begin_msg and log_end_msg directly, with no checks for $VERBOSE.
That *seems* like it should be the preferred behavior, so that any
alternative init system or output multiplexer could then take over the
log_* functions and always receive an appropriate message from every
init script (allowing, for instance, runtime toggles of $VERBOSE).

Changing log_* to check $VERBOSE internally would not break scripts like
the above one, but would also be compatible with dropping those checks.
The lintian message could then recommend dropping the $VERBOSE checks
and always using the log_* functions from /lib/lsb/init-functions rather
than echoing directly.

> What interface are the init scripts supposed to use that mimics the above
> behavior?  Or is the above behavior wrong?  I think the Lintian tag
> description needs to tell people what to replace the above construct with,
> given that we've been telling people to write init scripts like that for
> years and there are doubtless *tons* of them in Debian.

Agreed; I've retitled this bug appropriately.

> New ones will be introduced daily no matter what Lintian says as long as
> /etc/init.d/skeleton, which everything tells people to use as a starting
> point, has this code.  Is there already a bug open against sysvinit to
> change the skeleton script to do something else?

Not yet; cloning this bug against initscripts to do so.  I'll attach a
patch momentarily.

- Josh Triplett


Reply to: