Skip to content

feat!: raise the minimum bash from 3.0 to 3.2#888

Merged
Chemaclass merged 2 commits into
mainfrom
feat/bash-32-floor
Jul 25, 2026
Merged

feat!: raise the minimum bash from 3.0 to 3.2#888
Chemaclass merged 2 commits into
mainfrom
feat/bash-32-floor

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

Breaking change. 3.2 is the bash macOS ships, which is the reason for supporting an
old bash at all. 3.0 (2004) and 3.1 (2005) have no practical install base, and supporting
them has a real cost: they lack printf -v and +=, and predate the 3.2 change to
[[ =~ ]] quoting — so at a 3.0 floor a regex match behaves differently across
"supported" versions
, which is worse than not supporting them.

The gate also never enforced the declared minimum: it compared only the major, so every
3.x passed.

💡 Changes

  • Gate on major and minor; 3.0/3.1 are refused with a clear message. Verified against a real Bash 3.0 build, which is now correctly rejected
  • CI builds and tests a real Bash 3.2 instead of 3.0; the unit suite passes on it (1105 tests)
  • Update README, docs and install.sh to state 3.2+

🔧 Two rules corrections this work forced

  • perf-fork-budget.md claimed "Bash 3.0 has no [[ =~ ]]; the grep -E fork is mandatory". [[ =~ ]] works on a real 3.0 build. That fork follows from the house style rule preferring [ ], not from the version floor — so it is removable if the style rule is revisited
  • bash-style.md listed [[ ]] alongside genuinely 4.0+ constructs. Version constraints and style preferences are now separated, so the latter is not mistaken for the former

⚠️ Method note

Docker validation must invoke the script as an argument to the old bash
(/opt/bash-3.2/bin/bash ./bashunit …), as CI does. Using bash -c './bashunit …' goes
through the #!/usr/bin/env bash shebang and silently runs the container's default bash
5.x instead — I hit exactly that and re-verified everything.

3.2 is the bash macOS ships, which is the reason for supporting an old
bash at all. 3.0 (2004) and 3.1 (2005) have no practical install base,
and supporting them has a real cost: they lack printf -v and +=, and
predate the 3.2 change to [[ =~ ]] quoting, so a regex match behaves
DIFFERENTLY across 'supported' versions.

The gate compared only the major version, so every 3.x passed regardless
of the declared 3.0 minimum. It now checks the minor too.

Also corrects two claims in the rules that this work disproved:
- perf-fork-budget.md said Bash 3.0 has no [[ =~ ]] and the grep -E fork
  in assert_matches was therefore mandatory. [[ =~ ]] works on a real
  3.0 build; the fork follows from the house style rule preferring [ ],
  not from the version floor.
- bash-style.md listed [[ ]] alongside genuinely 4.0+ constructs. The two
  are now separated, so a style preference is not mistaken for a
  compatibility constraint.

CI builds and tests a real bash 3.2 instead of 3.0. Verified by running
the unit suite under both builds in Docker, invoking the script as an
argument to the old bash rather than through its shebang.
@Chemaclass Chemaclass added the enhancement New feature or request label Jul 25, 2026
@Chemaclass Chemaclass self-assigned this Jul 25, 2026
Testing a real bash 3.2 exposed a pre-existing gap rather than a
regression: mocks and spies are shell functions and do not cross the
process boundary into an external script on bash 3, but the skip guards
only covered 3.0 (major == 3 && minor < 1). CI had only ever run 3.0, so
these tests were always skipped and never ran on 3.2.

Confirmed pre-existing by running tests/functional/doubles_test.sh
against main under the same bash 3.2 image: it fails there identically.

All four CI modes (sequential, parallel, simple parallel, strict) now
pass on a real bash 3.2 build.
@Chemaclass
Chemaclass merged commit f18a1a3 into main Jul 25, 2026
40 checks passed
@Chemaclass
Chemaclass deleted the feat/bash-32-floor branch July 25, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant