From 98b7f7dd39ce84da64ec59fbe9e1dc4f27a74504 Mon Sep 17 00:00:00 2001 From: librelad Date: Thu, 13 Aug 2026 00:34:40 +0100 Subject: [PATCH] fix(updater): treat a flag in the version slot as a flag `updater upgrade --detach` parsed "--detach" as the target version and refused with "no safe path from 31-fpm-alpine to --detach". It failed safe, but blaming the version for a misplaced flag is a poor way to say the flag is not supported here. Unknown options now say so. Found during the first live ladder run. Co-Authored-By: Claude Opus 5 --- scripts/cli/commands/updater/cli_updater_commands.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/cli/commands/updater/cli_updater_commands.sh b/scripts/cli/commands/updater/cli_updater_commands.sh index 88bd9f9..ee5a54e 100644 --- a/scripts/cli/commands/updater/cli_updater_commands.sh +++ b/scripts/cli/commands/updater/cli_updater_commands.sh @@ -102,7 +102,15 @@ cliHandleUpdaterCommands() # latter needs a ladder, a verifier and a snapshot per step. if [[ -z "$app" ]]; then isError "Usage: libreportal updater upgrade [version] [--dry-run]"; return 1; fi local upgrade_target="$initial_command4" upgrade_mode="$initial_command5" - [[ "$upgrade_target" == "--dry-run" ]] && { upgrade_mode="--dry-run"; upgrade_target=""; } + # Any flag in the version slot is a flag, not a version. Without + # this, `upgrade --detach` treated "--detach" as the target + # and refused with "no safe path to --detach" — it failed safe, but + # blaming the version for a misplaced flag is a poor way to say + # "that flag isn't supported here". + case "$upgrade_target" in + --dry-run) upgrade_mode="--dry-run"; upgrade_target="" ;; + --*) isError "Unknown option '$upgrade_target'. Usage: libreportal updater upgrade [version] [--dry-run]"; return 1 ;; + esac for _f in cli_updater_ladder cli_updater_verify cli_updater_upgrade; do declare -F updaterUpgradeApp >/dev/null 2>&1 || \ source "$install_scripts_dir/cli/commands/updater/${_f}.sh" 2>/dev/null