On Fri, Sep 11, 2015 at 5:55 PM, Laura Abbott <[email protected]> wrote:
>
> Currently, modprobe fails with no output by default if the
> search paths it tries are missing:
>
> $ modprobe -S notakernel dm-crypt
> $
> $ modprobe -S notakernel lkjjweiojo
> $
>
> This is fairly cryptic and not at all obvious there is a problem
> unless the error code is checked or verbose flags are used.
> Add a message to give a better idea that something went wrong.
> ---
>  tools/modprobe.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/modprobe.c b/tools/modprobe.c
> index 3ba8f52..b50a385 100644
> --- a/tools/modprobe.c
> +++ b/tools/modprobe.c
> @@ -489,8 +489,11 @@ static int insmod(struct kmod_ctx *ctx, const char 
> *alias,
>                                                 const char *options) = NULL;
>
>         err = kmod_module_new_from_lookup(ctx, alias, &list);
> -       if (err < 0)
> +       if (err < 0) {
> +               ERR("Could not generate list of modules from context\n");
> +               ERR("(Is your version correct)?)\n");

I think we should not ask "is your version correct?", but rather give
information for the user to figure it out. So... maybe export
kmod_get_dirname() from the library and here do something like:

err = kmod_module_new_from_lookup(ctx, alias, &list);
if (err < 0) {
        ERR("Could not lookup module '%s' from module directory '%s'\n",
            alias, kmod_get_dirname(ctx));
        return err;
}

Actually this case is very similar to the check "list == NULL" below
this and maybe we should merge them with the same log message. What do
you think?


Lucas De Marchi
--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to