[PKG-OpenRC-Debian] Bug#874790: behaviour of insserv

Adam Borowski kilobyte at angband.pl
Fri Sep 22 03:36:03 UTC 2017


> When looking into source of lsb2rcconf I have found that it reads only file
> /etc/insserv.conf to solve dependencies of legacy rc scripts.
> However, the package rpcbind (which provides portmap service) installs its
> info into /etc/insserv.conf.d/rpcbind (and with sysv-rc also files in
> /etc/insserv.conf.d/ are read together with /etc/insserv.conf so it starts
> as intended when sysv-rc is used).
> So most likely lsb2rcconf should also read the files in /etc/insserv.conf.d/
> to be able to solve all the dependencies. (Some other packages add their
> files into /etc/insserv.conf.d/ too, for example dnsmasq or maradns.)

Indeed, we need to read stuff from /etc/insserv.conf.d/ too.
But not all files there are valid.  The relevant function in insserv is:

==========================================================================
static int cfgfile_filter(const struct dirent *restrict d)
{
    boolean ret = false;
    const char * name = d->d_name;
    const char * end;

    if (*name == '.')
        goto out;
    if (!name || (*name == '\0'))
        goto out;
    if ((end = strrchr(name, '.'))) {
        end++;
        if (!strncmp(end, "rpm", 3)     || /* .rpmorig, .rpmnew, .rmpsave, ... */
            !strncmp(end, "ba", 2)      || /* .bak, .backup, ... */
#ifdef SUSE
            !strcmp(end,  "local")      || /* .local are sourced by the basename */
#endif /* not SUSE */
            !strcmp(end,  "old")        ||
            !strcmp(end,  "new")        ||
            !strcmp(end,  "org")        ||
            !strcmp(end,  "orig")       ||
            !strncmp(end, "dpkg", 3)    || /* .dpkg-old, .dpkg-new ... */
            !strcmp(end,  "save")       ||
            !strcmp(end,  "swp")        || /* Used by vi like editors */
            !strcmp(end,  "core"))         /* modern core dump */
        {
            goto out;
        }
    }
    if ((end = strrchr(name, ','))) {
        end++;
        if (!strcmp(end,  "v"))           /* rcs-files */
            goto out;
    }
    ret = true;
out:
    return (int)ret;
}
==========================================================================

... which is so insane I don't think we should follow it.

[~]$ apt-file search insserv.conf.d
busybox-syslogd: /etc/insserv.conf.d/busybox-syslogd
dnsmasq: /etc/insserv.conf.d/dnsmasq
gdm3: /etc/insserv.conf.d/gdm3
lxdm: /etc/insserv.conf.d/lxdm
maradns: /etc/insserv.conf.d/maradns-insserv
mariadb-server-10.1: /etc/insserv.conf.d/mariadb
netscript-2.4: /etc/insserv.conf.d/netscript
nodm: /etc/insserv.conf.d/nodm
postfix: /etc/insserv.conf.d/postfix
rpcbind: /etc/insserv.conf.d/rpcbind
unbound: /etc/insserv.conf.d/unbound
wdm: /etc/insserv.conf.d/wdm
xdm: /etc/insserv.conf.d/xdm
xfstt: /etc/insserv.conf.d/xfstt

Something like /^[a-zA-Z0-9_-]+$/ (such as cron uses) would be better.


Meow!
-- 
⢀⣴⠾⠻⢶⣦⠀ I've read an article about how lively happy music boosts
⣾⠁⢰⠒⠀⣿⡁ productivity.  You can read it, too, you just need the
⢿⡄⠘⠷⠚⠋⠀ right music while doing so.  I recommend Skepticism
⠈⠳⣄⠀⠀⠀⠀ (funeral doom metal).



More information about the OpenRC-devel mailing list