test(compat): gate the too-new bash constructs at source level#882
Merged
Conversation
The Bash 3.0 CI job only catches a too-new construct when a test happens
to execute the line, so a ${var,,} inside a rarely-taken branch parses
fine and can ship. These greps reject the construct at source level
regardless of coverage.
Covers associative arrays, case-conversion expansion, negative array
subscripts, &>>, BASHPID, mapfile/readarray, namerefs, coproc and
parameter transformations. Each pattern was verified against a planted
violation, and comment lines are skipped so a construct quoted in the
learn tutorial text is not an error.
Only version-breaking syntax is gated. Style preferences are not
compatibility rules and are deliberately excluded -- notably [[ ]],
which works on every bash we support.
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.
🤔 Background
The prohibited-construct list in
.claude/rules/bash-style.mdwas enforced by reviewplus whatever the Bash 3.0 CI job happened to execute. A
${var,,}inside a rarely-takenbranch parses fine and only fails at runtime, so it could ship unnoticed.
bash_compatibility_test.shpreviously contained a single test.💡 Changes
&>>,BASHPID,mapfile/readarray, namerefs,coprocand parameter transformations at source level, independent of test coveragelearntutorial text is not an errorOnly version-breaking syntax is gated. Style preferences are excluded — notably
[[ ]],which was verified to work on real Bash 3.0 and is a house-style rule, not a
compatibility rule.