Skip to content

Guard option values in the remaining Launcher shell scripts - #417

Merged
patchzyy merged 2 commits into
patchzyy:mainfrom
mitsa-ng:launcher-arg-value-guards
Nov 17, 2026
Merged

patchzyy merged 2 commits into
patchzyy:mainfrom
mitsa-ng:launcher-arg-value-guards

Conversation

@mitsa-ng

Copy link
Copy Markdown
Contributor

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.sh was not the only Launcher script with hand-rolled opt) var=$2; shift 2 parsing. The same weakness existed in:

  • build-appimage.sh (2 value-taking options)
  • prepare-portable-tools.sh (2)
  • local-build.sh (19, including --workspace whose missing value previously surfaced as a confusing cd failure)
  • local-build-macos.command (14; its ${2:-} idiom silently accepted a missing or empty value)

Each script now has the identical require_value guard from #413 in front of every value-taking option. Scripts that already define fail() 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.sh gains rejection cases for every value-taking option of the three scripts that can be driven on any host: option-like value (--help as the swallowed value), empty value, and trailing value-less option. build-appimage.sh gets 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 -h cases, which work on main).

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

mitsa-ng and others added 2 commits November 17, 2026 09:19
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
patchzyy force-pushed the launcher-arg-value-guards branch from 1149f00 to 7955709 Compare November 17, 2026 08:20
@patchzyy
patchzyy merged commit 1388924 into patchzyy:main Nov 17, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants