chennaji9 opened a new pull request, #6811: URL: https://github.com/apache/rocketmq-dashboard/pull/6811
### Which Issue(s) This PR Fixes None — small self-contained fix found by inspection (no issue tracked). ### Brief Description `rmqctl/install.sh` parses its four value-taking options under `set -u` with a bare `VERSION="$2"; shift 2`: ```sh --version) VERSION="$2"; shift 2 ;; ``` Running `bash rmqctl/install.sh --version` (same for `--bin-dir`, `--os`, `--arch`) never reaches the script's own usage message — it dies on `line 52: $2: unbound variable` with no hint of which flag was at fault. Worse, `--version --os linux` silently swallows `--os` as the version value and continues into a download of a release tagged `v--os`. The four options now share a `require_option_value` guard that runs before `$2` is read: a missing value, or a value that is itself one of the installer's options (the swallow case), is rejected with the flag named plus the usage text, before any network access. Values that merely start with a dash (or contain spaces) stay values — only the installer's own option words are rejected. ### How Did You Test This Change? `cd rmqctl && go test ./scripts/` → **ok** (the new tests plus the existing script tests in the package). New `rmqctl/scripts/install_script_test.go` executes the script with a fake `curl` first on `PATH` that fails loudly if ever reached: - all four flags without a value, and the `--version --os linux` swallow → non-zero exit, output names the flag and prints the usage, contains no `unbound variable` and no `>> downloading` / `>> detecting` (validation fails before any network access); - `--bin-dir -tools/bin` (a dashed but legal value, with `--version` given) survives parsing and reaches the download step, so the guard cannot over-reject. Red side: the same tests against the unfixed script fail on every case — `../install.sh: line 52: $2: unbound variable` (lines 52–55, exactly the four parsing branches) and the swallow case reaching `>> downloading`. ### Checklist - [x] One coherent change; unrelated modifications are not bundled in - [x] Commit subject follows Conventional Commits (`fix:`) - [x] Tests added or updated for non-trivial changes (behavioural Go test executing the script; red-green on all five cases) - [x] New UI text has both Chinese and English entries under `web/src/i18n/` (n/a — no UI change) - [x] Architecture constraints stay green (test lives in the existing `rmqctl/scripts` test package; no new dependency) - [x] New source files carry the ASF license header (the new test file does) - [x] Documentation touched where behaviour changed (n/a — the usage text the script always intended to show is what it now shows) 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
