Bug#913247: Please provide a C implementation of /lib/init/init-d-script

Ian Jackson ijackson at chiark.greenend.org.uk
Thu Nov 22 14:26:10 GMT 2018

Mert Dirik writes ("Re: Bug#913247: Please provide a C implementation of /lib/init/init-d-script"):
> On 11/22/18, Ian Jackson <ijackson at chiark.greenend.org.uk> wrote:
> > I don't know what `systemd redirection' is.  Why does it not work ?
> > Can it be fixed ?
> To sum it up, when /lib/lsb/init-functions is sourced from a script in
> /etc/init.d, /lib/lsb/init-functions.d/40-systemd is also sourced and
> the script is executed using a corresponding "systemctl ...." command
> so that systemd can track the daemon. Relevant bug report is #826214.


This doesn't seem so difficult to fix.  (CCing that bug.)

> The problem here is, 40-systemd uses the value of "$0" to figure out
> whether the caller  was a script inside /etc/init.d/ and using

I just experimented:

mariner:d> pwd
mariner:d> egrep . init-d-script daemon
init-d-script:echo "in init-d-script \$0=$0 \$*=$*"
daemon:#!/usr/bin/env /u/iwj/junk/d/init-d-script
daemon:some thing or other
mariner:d> ./daemon start
in init-d-script $0=/u/iwj/junk/d/init-d-script $*=./daemon start

So I think this would be fixed if /lib/init/init-d-script detected
this situation and set $0 to the original script name (which it gets
in $1).  That is probably desirable anyway.


Ian Jackson <ijackson at chiark.greenend.org.uk>   These opinions are my own.

If I emailed you from an address @fyvzl.net or @evade.org.uk, that is
a private address which bypasses my fierce spamfilter.

More information about the Debian-init-diversity mailing list