Problem
Several stdlib numeric contracts accept decimal-looking strings but pass them directly to Bash arithmetic, where a leading zero selects octal interpretation.
At main commit a107134:
n=08; assert_integer_range n 0 10 prints an arithmetic error and then returns success.
exit_if_error 08 message prints an arithmetic error and continues instead of exiting.
assert_arg_count 08 0 10 can also continue after an arithmetic error.
assert_integer_range value 10 1 treats an inverted range as an ordinary out-of-range value instead of invalid helper usage.
Validation helpers must never turn malformed arithmetic into a successful guard.
Scope
- Normalize accepted integer strings to base-10 before arithmetic, including signs and leading zeros.
- Validate that range minimum is not greater than maximum.
- Require argument counts and bounds to be non-negative where the API represents counts.
- Validate
exit_if_error statuses as decimal shell exit codes and define handling outside 0..255.
Acceptance Criteria
08, 09, +08, and -08 are handled as decimal values where signed integers are accepted.
- No accepted numeric input emits a Bash arithmetic syntax error.
- Invalid ranges and exit codes fail through library diagnostics rather than continuing.
- Existing valid integer and status behavior remains unchanged.
Validation
bats lib/bash/std/tests/lib_std.bats
./tests/validate.sh
git diff --check
Problem
Several stdlib numeric contracts accept decimal-looking strings but pass them directly to Bash arithmetic, where a leading zero selects octal interpretation.
At
maincommita107134:n=08; assert_integer_range n 0 10prints an arithmetic error and then returns success.exit_if_error 08 messageprints an arithmetic error and continues instead of exiting.assert_arg_count 08 0 10can also continue after an arithmetic error.assert_integer_range value 10 1treats an inverted range as an ordinary out-of-range value instead of invalid helper usage.Validation helpers must never turn malformed arithmetic into a successful guard.
Scope
exit_if_errorstatuses as decimal shell exit codes and define handling outside0..255.Acceptance Criteria
08,09,+08, and-08are handled as decimal values where signed integers are accepted.Validation
bats lib/bash/std/tests/lib_std.bats./tests/validate.shgit diff --check