Skip to content

fix(shell): blacklist POSIX-only shells for bash tool#15610

Open
Br1an67 wants to merge 1 commit intoanomalyco:devfrom
Br1an67:fix/issue-3340-mkdir-brace-expansion
Open

fix(shell): blacklist POSIX-only shells for bash tool#15610
Br1an67 wants to merge 1 commit intoanomalyco:devfrom
Br1an67:fix/issue-3340-mkdir-brace-expansion

Conversation

@Br1an67
Copy link

@Br1an67 Br1an67 commented Mar 1, 2026

Issue for this PR

Closes #3340

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When $SHELL is a POSIX-only shell (sh, dash, ash), brace expansion in mkdir -p src/{a,b,c} doesn't work — creating a literal src/{a,b,c} folder instead of three separate directories.

LLMs routinely generate bash-compatible syntax with brace expansion. The acceptable() shell selector already blacklists fish and nu, but not POSIX-only shells. This adds sh, dash, and ash to the blacklist so fallback() picks bash (or zsh on macOS) instead, which all support brace expansion.

The fallback() already has the right priority: bash → sh. This change just ensures the acceptable shell selector doesn't short-circuit to a POSIX-only $SHELL.

How did you verify your code works?

  • Verified sh -c "mkdir -p /tmp/test/{a,b,c}" creates literal folder vs bash -c "mkdir -p /tmp/test/{a,b,c}" creates three
  • Checked fallback() priority chain: on Linux it tries Bun.which("bash") first before falling to /bin/sh

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

LLMs generate bash syntax (brace expansion, arrays, etc.) but when
$SHELL is /bin/sh or dash, the shell doesn't expand braces, creating
literal folders like `src/{a,b,c}` instead of three directories.

Add sh, dash, and ash to the acceptable() blacklist so the fallback
picks bash (or zsh on macOS) instead.
@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2026

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one potentially related PR:

PR #9724: feat(opencode): add configurable shell resolution with plugin support
#9724

This PR may be related because it deals with shell resolution logic, which is directly relevant to your PR's focus on improving shell selection in the fallback() and acceptable() functions. However, #9724 appears to be a broader feature for configurable shell resolution, while #15610 is specifically fixing the POSIX-only shell issue.

Note: The search results keep returning PR #15610 (the current PR), which is expected since it's the most relevant match.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

agents will create empty folders it didn't mean to when using mkdir -p {src,test,...}

1 participant