Context
The Bash libraries document Bash 4.2+ support, but lib_std.sh currently exposes only a passive check_bash_version helper and continues defining Bash-4-only functions during source-time initialization.
On macOS /bin/bash 3.2, sourcing the stdlib can emit raw syntax errors and still continue far enough to mislead callers.
Scope
- Add a source-time guard near the top of
lib/bash/std/lib_std.sh before Bash-4-specific syntax is parsed or executed as much as Bash allows.
- Emit a concise, user-facing error that says Bash 4.2+ is required and includes the current
$BASH_VERSION.
- Return nonzero when sourced from an unsupported shell.
- Keep
check_bash_version available for supported shells as the passive helper.
Acceptance Criteria
- Sourcing
lib_std.sh under Bash 3.2 fails cleanly instead of producing parser/internal errors.
- Sourcing under supported Bash versions still initializes normally.
- Tests cover supported initialization and unsupported-version behavior.
Validation
Suggested Branch
bug/<issue>-20260618-bash-version-guard
Context
The Bash libraries document Bash 4.2+ support, but
lib_std.shcurrently exposes only a passivecheck_bash_versionhelper and continues defining Bash-4-only functions during source-time initialization.On macOS
/bin/bash3.2, sourcing the stdlib can emit raw syntax errors and still continue far enough to mislead callers.Scope
lib/bash/std/lib_std.shbefore Bash-4-specific syntax is parsed or executed as much as Bash allows.$BASH_VERSION.check_bash_versionavailable for supported shells as the passive helper.Acceptance Criteria
lib_std.shunder Bash 3.2 fails cleanly instead of producing parser/internal errors.Validation
./tests/validate.shSuggested Branch
bug/<issue>-20260618-bash-version-guard