Package: ifupdown
Version: 0.8.35
Severity: important

I've just hardly bit by a system in which for some reason yet to
discover the otherwise empty directory /etc/network/if-pre-up.d/ was
removed.
At the next boot, the network didn't come up because of
    May  9 14:15:55 XXXX ifup[310]: run-parts: failed to open directory 
/etc/network/if-pre-up.d: No such file or directory

Looking at the code,
https://sources.debian.org/src/ifupdown/0.8.35/execute.c/?hl=181#L181
|    static int execute_scripts(interface_defn *ifd, execfn *exec, char *opt) {
|        ...
|        char *command;
|        if(asprintf(&command, "/bin/run-parts %s%s/etc/network/if-%s.d", 
ignore_failures ? "" : "--exit-on-error ", verbose ? "--verbose " : "", opt) == 
-1)
|            err(1, "asprintf");
|        int result = (*exec) (command);
|        ...
|        return ignore_failures ? 1 : result;
|    }

Now, `run-parts` just fails if you pass a non-existing directory.

I believe you should check for the directory existence before trying to
run run-parts on it.

-- 
regards,
                        Mattia Rizzolo

GPG Key: 66AE 2B4A FCCF 3F52 DA18  4D18 4B04 3FCD B944 4540      .''`.
More about me:  https://mapreri.org                             : :'  :
Launchpad user: https://launchpad.net/~mapreri                  `. `'`
Debian QA page: https://qa.debian.org/developer.php?login=mattia  `-

Attachment: signature.asc
Description: PGP signature

Reply via email to