Context *c = ASSERT_PTR(userdata);
int r;
- assert(argc == 2);
+ assert(argc >= 2);
assert(argv);
+ if (argc > 2)
+ log_debug("Too many arguments specified. 'kernel-install remove' takes only kernel version. "
+ "Ignoring residual arguments.");
+
c->action = ACTION_REMOVE;
r = context_set_version(c, argv[1]);
static int run(int argc, char* argv[]) {
static const Verb verbs[] = {
{ "add", 3, VERB_ANY, 0, verb_add },
- { "remove", 2, 2, 0, verb_remove },
+ { "remove", 2, VERB_ANY, 0, verb_remove },
{ "inspect", 1, 2, VERB_DEFAULT, verb_inspect },
{}
};
test ! -e "$BOOT_ROOT/the-token/1.1.1/linux"
test ! -e "$BOOT_ROOT/the-token/1.1.1/initrd"
+# Test again with too many arguments for 'remove' command. See #28448.
+"$kernel_install" -v add 1.1.1 "$D/sources/linux" "$D/sources/initrd"
+
+test -f "$entry"
+test -f "$BOOT_ROOT/the-token/1.1.1/linux"
+test -f "$BOOT_ROOT/the-token/1.1.1/initrd"
+
+"$kernel_install" -v remove 1.1.1 hoge foo bar
+test ! -e "$entry"
+test ! -e "$BOOT_ROOT/the-token/1.1.1/linux"
+test ! -e "$BOOT_ROOT/the-token/1.1.1/initrd"
+
# Invoke kernel-install as installkernel
ln -s --relative -v "$kernel_install" "$D/sources/installkernel"
"$D/sources/installkernel" -v 1.1.2 "$D/sources/linux" System.map /somedirignored