You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "chennaji9 (via GitHub)" <gi...@apache.org> on 2026/10/15 18:29:56 UTC
[PR] fix(rmqctl): report missing installer option values clearly [rocketmq-dashboard]
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(rmqctl): report missing installer option values clearly [rocketmq-dashboard]
Posted by "chennaji9 (via GitHub)" <gi...@apache.org>.
chennaji9 commented on PR #6811:
URL: https://github.com/apache/rocketmq-dashboard/pull/6811#issuecomment-6359277134
The subtle case turned out to be `--version --os linux`: not a missing value but a swallowed one, which sails into downloading release v--os. Rejecting only the installer's own option words (not every dashed string) keeps `--bin-dir -tools/bin` working, and the guard runs before any network access, which the fake-curl test enforces.
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(rmqctl): report missing installer option values clearly [rocketmq-dashboard]
Posted by "chennaji9 (via GitHub)" <gi...@apache.org>.
chennaji9 commented on PR #6811:
URL: https://github.com/apache/rocketmq-dashboard/pull/6811#issuecomment-6520027844
Re-verified the guard cannot over-reject: a value that merely starts with a dash (e.g. `--bin-dir -tools/bin`) still parses as a value, because only the installer's own option words are treated as a missing-value indicator. The usage text now appears exactly where the old script used to die with `$2: unbound variable`.
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(rmqctl): report missing installer option values clearly [rocketmq-dashboard]
Posted by "github-actions[bot] (via GitHub) via commits" <co...@rocketmq.apache.org>.
github-actions[bot] closed pull request #6811: fix(rmqctl): report missing installer option values clearly
URL: https://github.com/apache/rocketmq-dashboard/pull/6811
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(rmqctl): report missing installer option values clearly [rocketmq-dashboard]
Posted by "github-actions[bot] (via GitHub) via commits" <co...@rocketmq.apache.org>.
github-actions[bot] commented on PR #6811:
URL: https://github.com/apache/rocketmq-dashboard/pull/6811#issuecomment-6699323163
This pull request has been automatically closed because there has been no activity for 7 days. If you would like to continue working on this, please reopen the PR with updated changes.
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org