]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
modprobe: Fix assertion on --show-depends with bogus config file
authorLucas De Marchi <lucas.de.marchi@gmail.com>
Thu, 21 Mar 2013 05:33:25 +0000 (02:33 -0300)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Thu, 21 Mar 2013 05:33:25 +0000 (02:33 -0300)
Putting something like "alias psmouse deadbeef" is a hackish way to
blacklist a module. While I don't encourage doing so, let's not explode
if we fiund such config files.

A small difference from the behavior of module-init-tools: we exit with
0 instead of 1.

testsuite/test-modprobe.c
tools/modprobe.c

index 775a995ed1ce662bc270d5189803e57c338066ef..cc90dae8b10d2cb7efe0e67a02aaa0833c0b6488 100644 (file)
@@ -85,7 +85,6 @@ static __noreturn int modprobe_show_alias_to_none(const struct test *t)
 }
 static DEFINE_TEST(modprobe_show_alias_to_none,
        .description = "check if modprobe --show-depends doesn't explode with an alias to nothing",
-       .expected_fail = true,
        .config = {
                [TC_UNAME_R] = "4.4.4",
                [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/alias-to-none",
index 64674b00496de4f4adf3b0ff4970febbc82379b1..1b8c96e6d93f7960b4fa08d3d870995e2efd1e2a 100644 (file)
@@ -495,8 +495,12 @@ static void print_action(struct kmod_module *m, bool install,
        path = kmod_module_get_path(m);
 
        if (path == NULL) {
-               assert(kmod_module_get_initstate(m) == KMOD_MODULE_BUILTIN);
-               printf("builtin %s\n", kmod_module_get_name(m));
+               /*
+                * Either a builtin module, or an alias, print only for
+                * builtin
+                */
+               if (kmod_module_get_initstate(m) == KMOD_MODULE_BUILTIN)
+                       printf("builtin %s\n", kmod_module_get_name(m));
        } else
                printf("insmod %s %s\n", kmod_module_get_path(m), options);
 }