Skip to content

fix(backup): validate argument counts for options in ods-backup.sh - #6325

Closed
vaibhavsrv wants to merge 1 commit into
Osmantic:public-betafrom
vaibhavsrv:fix/backup-option-arg-count
Closed

vaibhavsrv wants to merge 1 commit into
Osmantic:public-betafrom
vaibhavsrv:fix/backup-option-arg-count

Conversation

@vaibhavsrv

Copy link
Copy Markdown
Contributor

Why this matters

In ods/ods-backup.sh, option parsing for -o|--output and -t|--type executes shift 2 unconditionally without checking remaining argument count. When an operator or wrapper script passes -o or -t as the final flag without an option value, Bash with set -euo pipefail halts with an unhandled internal shell error shift count must be <= $#.

This patch introduces explicit argument presence guards [[ $# -ge 2 ]] || { log_error "Option $1 requires an argument"; exit 1; } for both flags before shifting. Existing backup types, retention policies, and compression handling remain completely untouched.

Validation

  • Baseline: Invoking bash ods-backup.sh -o or bash ods-backup.sh -t failed with internal shell shift error and non-zero exit code before usage diagnostics.
  • Post-fix: Exits with code 1 and writes Option <flag> requires an argument to stderr; valid backup operations proceed normally.
  • Backup option parser suites: 2 passed. New-test Ruff, ShellCheck, and diff checks pass; new regressions wired into Linux CI.

Overlap check

Risk / AI disclosure

AI-assisted investigation, implementation and CLI regressions. This strengthens a CLI option guard, 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 #6324 at 5662f0d without conflicts. Production and test diffs passed together; backup and restore workflows 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.

@Lightheartdevs

Copy link
Copy Markdown
Collaborator

Thanks for this contribution. public-beta was promoted into main on 2026-09-24 and no longer receives changes, so we're closing pull requests that target it. This isn't a judgment on the change itself. If it's still needed, please rebase onto main and open a focused PR. See #7253 for details and the contribution policy.

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