Skip to content

Replace mapfile usage for broader Bash compatibility#1497

Merged
CatChen merged 1 commit intomainfrom
codex/investigate-test-failures-related-to-mapfile-n4wk0c
Feb 22, 2026
Merged

Replace mapfile usage for broader Bash compatibility#1497
CatChen merged 1 commit intomainfrom
codex/investigate-test-failures-related-to-mapfile-n4wk0c

Conversation

@CatChen
Copy link
Copy Markdown
Owner

@CatChen CatChen commented Feb 22, 2026

Motivation

  • CI for downstream projects reported failures complaining about mapfile: command not found, which is caused by using the Bash-4+ builtin mapfile on runners that have older Bash (notably macOS Bash 3.2) or minimal shells.
  • The goal is to avoid Bash-version-specific builtins so the action runs reliably on a wider set of GitHub runners.

Description

  • Replaced mapfile -t TARGET_PATHS < <(printf '%s' "$TARGETS") with a portable while IFS= read -r TARGET_PATH || [[ -n "$TARGET_PATH" ]] loop that appends to TARGET_PATHS.
  • Replaced mapfile -t CHANGED_FILES < <(git diff --name-only ... ) with a while IFS= read -r CHANGED_FILE || [[ -n "$CHANGED_FILE" ]] loop that fills CHANGED_FILES from process substitution.
  • Applied the same TARGETS parsing change in the git commit step so both the git-status and git-commit steps no longer rely on mapfile.
  • Kept quoting, array handling, and empty-line semantics intact to preserve original behavior.

Testing

  • Ran rg -n "mapfile" action.yml and confirmed there are no remaining mapfile usages (success).
  • Ran git diff --stat HEAD~1..HEAD to verify the expected changes were produced to action.yml (success).
  • Ran git status --short and inspected action.yml with nl -ba action.yml | sed -n ... to validate the replacements are in the intended locations (success).

Codex Task

github-actions bot added a commit that referenced this pull request Feb 22, 2026
github-actions bot added a commit that referenced this pull request Feb 22, 2026
github-actions bot added a commit that referenced this pull request Feb 22, 2026
github-actions bot added a commit that referenced this pull request Feb 22, 2026
@CatChen CatChen changed the title Preserve exact TARGETS parsing by using printf via process substitution Replace mapfile usage for broader Bash compatibility Feb 22, 2026
@github-actions
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

Checks from Push Test PR #1505

Check Status Time
GitGuardian Security Checks 1s

@github-actions
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

@CatChen CatChen merged commit 7a81d00 into main Feb 22, 2026
13 checks passed
@CatChen CatChen deleted the codex/investigate-test-failures-related-to-mapfile-n4wk0c branch February 22, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant