fix(compose): reject missing option arguments in validate-compose-stack.sh - #6452
Closed
vaibhavsrv wants to merge 3 commits into
Closed
vaibhavsrv wants to merge 3 commits into
vaibhavsrv wants to merge 3 commits into
Conversation
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.
Why this matters
In
ods/scripts/validate-compose-stack.sh, the CLI argument parsing loop unconditionally executedshift 2when encountering--compose-flagsor--env-file. When either option was passed as the final argument without a corresponding parameter value, executingshift 2underset -euo pipefailcaused Bash to halt abruptly with an unhandled exit 1 and an empty standard error. Consequently, the script's intended check (ERROR: --compose-flags required) was never reached. Furthermore, passing an option without a value immediately before another supported flag (such as--compose-flags --quietor--env-file --compose-flags) caused the parser to mistakenly swallow the subsequent flag as the argument value, suppressing the flag's effect and forwarding invalid configuration to Docker Compose.This change introduces pre-shift parameter presence validation for both
--compose-flagsand--env-file. If an argument is missing, empty, or set to another option flag, the parser outputs an informative diagnostic (ERROR: <option> requires an argument) to standard error and exits cleanly with usage status 1. Valid arguments, combined flags, and downstream Docker Compose invocation contracts remain intact.Validation
bash ods/scripts/validate-compose-stack.sh --compose-flagsor--env-filehalted with unhandled exit code 1 and an empty standard error; passing--compose-flags --quietsilently swallowed--quietintoCOMPOSE_FLAGSand attempted an invalid compose config.ods/tests/test_validate_compose_stack_option_args.pyconfirms that missing, empty, or option-hijacking invocations fail with exit code 1 and output the appropriateERROR: <option> requires an argumentdiagnostic, while valid invocations dispatch cleanly.Overlap check
install-core.sh,ods-backup.sh,pre-download.sh, andods-test.sh; did not touchvalidate-compose-stack.sh.load-backend-contract.sh; completely separate script.classify-hardware.shandpreflight-engine.sh; separate CLI utilities.Risk / AI disclosure
AI-assisted investigation, implementation and CLI regressions. This strengthens a CLI check, not runtime admission. Independent human review and platform/runtime qualification remain gates. No running configuration, deployment or upstream merge changed.
Follow-up integration evidence
Composed with #6447 at ce21032 without conflicts. Production and test diffs passed together; compose validation and diagnostic bundle checks remain intact.
Backlog composition was local-only (production/test diffs, excluding workflow/Makefile wiring); it is not an upstream merge or independent human approval. Declared live-review gates remain open.