Skip to content

🐛 fix(actions): guard empty arrays for bash 3.2 - #50

Merged
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:fix/bash32-empty-arrays
Nov 4, 2026
Merged

gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:fix/bash32-empty-arrays

Conversation

@gaborbernat

Copy link
Copy Markdown
Member

A macOS job that calls install-locked-tools or export-build-constraints without targets stopped with unbound variable before it exported any build constraints. 🍎 The same expansion appears in other Actions and in the check workflow, whose test jobs run on the caller's runner. After this merges, those jobs run to completion with empty inputs, and callers need no change.

Each Action guards the arrays that can be empty with ${array[@]+"${array[@]}"}, the form that Bash 3.2 accepts, and leaves arrays that are always filled as they are. Bash 5 gives the same result for both forms, so Ubuntu runners see no change. A check reads the run blocks of every Action, the shared scripts, and the workflow jobs whose runner comes from an expression. It fails on an unguarded expansion that is not on its list of arrays that cannot be empty, and each entry on that list carries a reason.

This change covers empty arrays only. ⚠️ Bash 3.2 still rejects other constructs in these Actions: render-release-notes calls mapfile, a Bash 4 builtin, and prepare-jetbrains-post-release has a conditional expression that Bash 3.2 cannot parse. Under en_US.UTF-8, the publish-post-release-pr manifest check accepts an uppercase B as a hex digit on Bash 3.2. The ubuntu-only update-python-dependencies workflow expands empty arrays the same way and is unchanged.

macOS runners run `shell: bash` steps with /bin/bash 3.2. Under `set -u`
that shell aborts on `"${array[@]}"` when the array is empty, so
`install-locked-tools` failed on macOS when no targets were given. The
other composite Actions and the check workflow expand arrays the same way.

Expand arrays that can be empty with `${array[@]+"${array[@]}"}`, which
bash 3.2 accepts. Arrays that are always filled where they expand keep the
plain form. A test scans the run blocks of every Action, the tools scripts,
and the workflow jobs that take their runner from an expression, and fails
on any unguarded expansion that is not on its list of provably non-empty
arrays.
@gaborbernat gaborbernat added the bug Something isn't working label Nov 4, 2026
@gaborbernat
gaborbernat merged commit f7626e0 into tox-dev:main Nov 4, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant