Skip to content

shell: empty-array expansion under set -u aborts on bash < 4.4 at sites that skip the house idiom #3425

Description

@kyle-sexton

Context

Found by the repo-wide /code-tidying:batch-simplify sweep (62 groups / 986 files, branch claude/repo-code-tidying-batch-twhddw). The sweep's doctrine files latent defects instead of fixing them mid-sweep, because the fix changes observable behavior; this issue is that filing.

Several scripts expand possibly-empty arrays as bare "${arr[@]}" under set -u, which aborts with an unbound-variable error on bash 4.0-4.3 while the rest of the repo uses the ${arr[@]+"${arr[@]}"} guard. Worst case: plugins/work-items/scripts/backfill-capability-tier-labels.sh:44-47,62,69,135 (repo_args=() expanded while empty). Also: plugins/repo-hygiene git-tree-reset-batch.sh + git-tree-reset.sh (8 sites), scripts/check-changed-skills.sh:133, scripts/check-changelog-parity.sh:587 (+siblings).

Proposed work

  • Convert the listed sites to the house ${arr[@]+"${arr[@]}"} idiom (or declare the supported-bash floor repo-wide and close as wontfix).

Acceptance criteria

  • All listed sites use the guarded idiom, or the repo documents bash >= 4.4 as the floor and this class is closed.

References

  • plugins/work-items/scripts/backfill-capability-tier-labels.sh:44
  • plugins/repo-hygiene/skills/clean/scripts/git-tree-reset-batch.sh
  • scripts/check-changed-skills.sh:133
  • scripts/check-changelog-parity.sh:587

Filed by the /code-tidying:batch-simplify closeout (Phase 8).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions