From 665372c19d7f54b5cfb92aaf313b7df9570f6191 Mon Sep 17 00:00:00 2001 From: Lyndon Brown Date: Tue, 5 May 2020 18:58:39 +0100 Subject: config: catch and report unexpected arguments after handling arguments, catch and report any remaining "non-option" arguments. for instance users could make the basic mistake of using `lb config --bootloaders syslinux grub-efi`, i.e. failing to quote the multiple bootloaders (i actually encountered a user doing this who swore that "it just worked"). catching and reporting such mistakes could be valuable to users. previous behaviour: ``` $ lb config --bootloaders syslinux grub-efi P: Updating config tree for a debian/buster/amd64 system P: Symlinking hooks... ``` new behaviour: ``` $ lb config --bootloaders syslinux grub-efi [2020-05-05 18:56:07] lb config --bootloaders syslinux grub-efi E: Unexpected argument found: grub-efi ``` Gbp-Dch: Short --- scripts/build/config | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/build/config b/scripts/build/config index 2bd929bc1..da8f3ce2f 100755 --- a/scripts/build/config +++ b/scripts/build/config @@ -822,6 +822,15 @@ Local_arguments () ;; esac done + + # Any remaining arguments should be reported as an unexpected arguments error. + if [ $# -ne 0 ]; then + local ARG + for ARG in "${@}"; do + Echo_error "Unexpected argument found: %s" "${ARG}" + done + exit 1 + fi } # Processing args such that we have a value for --config if given -- cgit v1.2.3