From: Lucas De Marchi Date: Thu, 21 Mar 2013 05:33:25 +0000 (-0300) Subject: modprobe: Fix assertion on --show-depends with bogus config file X-Git-Tag: v13~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ace742fa9aee1aec5931d5ee8a51fa9b8f0d94e0;p=thirdparty%2Fkmod.git modprobe: Fix assertion on --show-depends with bogus config file 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. --- diff --git a/testsuite/test-modprobe.c b/testsuite/test-modprobe.c index 775a995e..cc90dae8 100644 --- a/testsuite/test-modprobe.c +++ b/testsuite/test-modprobe.c @@ -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", diff --git a/tools/modprobe.c b/tools/modprobe.c index 64674b00..1b8c96e6 100644 --- a/tools/modprobe.c +++ b/tools/modprobe.c @@ -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); }