Repository navigation
Guard option values in the remaining Launcher shell scripts - #417
Merged
Merged
Conversation
Contributor
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
The same hand-rolled 'opt) var=$2; shift 2' parsing that patchzyy#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.
patchzyy
force-pushed
the
launcher-arg-value-guards
branch
from
November 17, 2026 08:20
1149f00 to
7955709
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #413 (issue #274).
Stacking note: this branch sits on top of #413's branch, so until #413 merges the PR shows its commit too; the diff automatically reduces to just this change once #413 lands. Reviewing #413 first is the intended order.
What
Prepare-NativePrebuilt.shwas not the only Launcher script with hand-rolledopt) var=$2; shift 2parsing. The same weakness existed in:build-appimage.sh(2 value-taking options)prepare-portable-tools.sh(2)local-build.sh(19, including--workspacewhose missing value previously surfaced as a confusingcdfailure)local-build-macos.command(14; its${2:-}idiom silently accepted a missing or empty value)Each script now has the identical
require_valueguard from #413 in front of every value-taking option. Scripts that already definefail()before their parser (local-build.sh,local-build-macos.command) report through it; the others keep their existing<script>: ...echo prefix. Flag-only options are untouched.Testing
Test-NativePrebuiltParser.shgains rejection cases for every value-taking option of the three scripts that can be driven on any host: option-like value (--helpas the swallowed value), empty value, and trailing value-less option.build-appimage.shgets the same edit but is not driven: its pre-parser ELF architecture probe exits on a non-Linux userspace before the argument parser runs.Full suite: 60/60 pass with the guards; against the pre-fix scripts 56 of the 60 fail (the 4 passes are #413's own valid-parse and
-hcases, which work on main).