Goal
normalize integer configuration before publishing to integer variables.
Background and evidence
Release-preparation review of a90aa1429647b6eb4820a01aabe37799ca55ad5e on macOS arm64. Bash 5.3.20; ordinary local POSIX filesystem.
base_app_config_load accepts decimal-looking values such as 010, 08, and 18446744073709551616. base_app_config_get then passes the raw string to printf -v for a caller-declared -i output. Bash evaluates it as arithmetic, causing inconsistent values, overflow, or terminating the shell.
source lib/bash/std/lib_std.sh
base_std_import app/lib_app.sh
base_app_init demo
base_app_config_define demo count integer
base_app_config_load demo --cli count=010
value=''; declare -i number=99
base_app_config_get demo count value
base_app_config_get demo count number
printf 'scalar=%s integer=%s\n' "$value" "$number"
Actual: scalar=010 integer=8. Loading count=08 succeeds but getting it into an integer emits value too great for base and exits a non-interactive Bash subprocess before subsequent statements. Loading 18446744073709551616 and getting into an integer silently yields 0 on this 64-bit host.
The README explicitly supports ordinary and integer scalar outputs for integer-typed config. The existing output-attribute tests do not exercise leading zeros, the signed range boundary, or overflow.
Scope and acceptance criteria
- Define the integer domain and use decimal normalization before arithmetic assignment.
- Reject out-of-range inputs recoverably before publication, or explicitly support arbitrary precision only where the destination can represent it.
- Keep outputs unchanged on rejected values and preserve the previous successful config snapshot on load failure.
- Add tests for 0, negative values, 010, 08/09, signed boundaries, oversized values, and both scalar/-i destinations in subprocesses that must remain alive.
Validation
Run focused app/std BATS, Bash 4.2/current option probes, and full validation. Reuse the existing decimal-validation machinery where appropriate.
Source references:
Non-goals
No release publication or unrelated API redesign. Preserve documented compatibility except for the defective behavior identified above.
Project fields
- Project:
base-bash-libs
- Status:
Ready
- Priority:
P2
- Area:
Shell
- Initiative:
Adoption Polish
- Size:
M
- Milestone:
v2.2.0
Agent assignment
Assignee: @codeforester. Implementation may be handled through the normal issue-backed worktree and reviewed PR workflow.
Goal
normalize integer configuration before publishing to integer variables.
Background and evidence
Release-preparation review of
a90aa1429647b6eb4820a01aabe37799ca55ad5eon macOS arm64. Bash 5.3.20; ordinary local POSIX filesystem.base_app_config_loadaccepts decimal-looking values such as010,08, and18446744073709551616.base_app_config_getthen passes the raw string toprintf -vfor a caller-declared-ioutput. Bash evaluates it as arithmetic, causing inconsistent values, overflow, or terminating the shell.Actual:
scalar=010 integer=8. Loadingcount=08succeeds but getting it into an integer emitsvalue too great for baseand exits a non-interactive Bash subprocess before subsequent statements. Loading18446744073709551616and getting into an integer silently yields0on this 64-bit host.The README explicitly supports ordinary and integer scalar outputs for integer-typed config. The existing output-attribute tests do not exercise leading zeros, the signed range boundary, or overflow.
Scope and acceptance criteria
Validation
Run focused app/std BATS, Bash 4.2/current option probes, and full validation. Reuse the existing decimal-validation machinery where appropriate.
Source references:
Non-goals
No release publication or unrelated API redesign. Preserve documented compatibility except for the defective behavior identified above.
Project fields
base-bash-libsReadyP2ShellAdoption PolishMv2.2.0Agent assignment
Assignee: @codeforester. Implementation may be handled through the normal issue-backed worktree and reviewed PR workflow.