From e0654c937422b8629726c1f6a28555ce4407620e Mon Sep 17 00:00:00 2001 From: Nati Date: Sun, 15 Nov 2026 02:24:48 +0800 Subject: [PATCH 1/2] guard option values in the remaining Launcher shell scripts The same hand-rolled 'opt) var=$2; shift 2' parsing that #274 fixed in Prepare-NativePrebuilt.sh exists in the other shell entry points: build-appimage.sh, prepare-portable-tools.sh, local-build.sh (19 value-taking options), and local-build-macos.command. A missing value died on set -u or a confusing cd error, an empty one was silently accepted, and a following option was swallowed as the value. Each script gets the same require_value guard before reading or shifting any value-taking option; scripts that define fail() before their parser (local-build.sh, local-build-macos.command) report through it, the others match their existing echo prefix. Flag-only options are unchanged. Test-NativePrebuiltParser.sh grows rejection cases for the three scripts that can be safely driven on any host (build-appimage.sh runs a pre-parser ELF architecture probe that exits on non-Linux userspaces, so it is edited but not driven). 60 cases pass with the guards, 56 of them fail against the pre-fix scripts. --- Launcher/Test-NativePrebuiltParser.sh | 56 +++++++++++++++++++++++++++ Launcher/build-appimage.sh | 17 +++++++- Launcher/local-build-macos.command | 39 ++++++++++++------- Launcher/local-build.sh | 49 ++++++++++++++--------- Launcher/prepare-portable-tools.sh | 17 +++++++- 5 files changed, 141 insertions(+), 37 deletions(-) diff --git a/Launcher/Test-NativePrebuiltParser.sh b/Launcher/Test-NativePrebuiltParser.sh index f1da4f247..04eee77cc 100755 --- a/Launcher/Test-NativePrebuiltParser.sh +++ b/Launcher/Test-NativePrebuiltParser.sh @@ -105,6 +105,62 @@ else failed=$((failed + 1)) fi +# --------------------------------------------------------------------------- +# The same guard on the other Launcher shell entry points. Only rejection paths are +# exercised: unlike Prepare-NativePrebuilt.sh these scripts have no parse-only mode, so an +# accepted command line would start real work. build-appimage.sh is edited but not driven +# here: its pre-parser ELF architecture probe exits on a non-Linux userspace before the +# argument parser is reached. +# --------------------------------------------------------------------------- + +# expect_value_reject