]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
tools/modprobe: Fix odd --remove-holders behavior
authorLucas De Marchi <lucas.de.marchi@gmail.com>
Fri, 13 Jun 2025 18:57:08 +0000 (13:57 -0500)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Mon, 16 Jun 2025 12:36:44 +0000 (07:36 -0500)
--remove-holders was not implying --remove, which means that if the user
called `modprobe --remove-holders xe` it would actually try to insert
the xe module. Fix it and spell it out in the man page about one option
implying the other.

Considering i915 is not currently loaded:

Before:
kmod $ ./build/modprobe -v --dry-run --remove-holders i915
insmod /lib/modules/6.14.11-1-MANJARO/kernel/drivers/char/agp/intel-gtt.ko.zst
insmod /lib/modules/6.14.11-1-MANJARO/kernel/drivers/gpu/drm/i915/i915.ko.zst
kmod $

After:
kmod $ ./build/modprobe -v --dry-run --remove-holders i915
kmod $

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/372
man/modprobe.8.scd
tools/modprobe.c

index 509d445672cae02e1c5c119f89eb9d09cf5a7c24..aaf04c343bbebce2e1d35d50a30438d617a871dd 100644 (file)
@@ -169,6 +169,7 @@ database.
 *--remove-holders*
        This option causes *modprobe* to remove the mentioned module(s), alongside
        other modules that depend on it/them - aka the reverse dependency list.
+       This options implies --remove.
 
        For compatibility reasons *--remove-dependencies* is also accepted for
        this option but will be removed after kmod 36.
index 81b19606cafbe434e7a3a04be98f7b29cec0afb3..fa9757e24f085c0b1e8a9254f01a3bd1303a7e37 100644 (file)
@@ -827,6 +827,7 @@ static int do_modprobe(int argc, char **orig_argv)
                        /* fall through */
                case 5:
                        remove_holders = 1;
+                       do_remove = 1;
                        break;
                case 'w': {
                        char *endptr = NULL;