fix(shell): blacklist POSIX-only shells for bash tool#15610
Open
Br1an67 wants to merge 1 commit intoanomalyco:devfrom
Open
fix(shell): blacklist POSIX-only shells for bash tool#15610Br1an67 wants to merge 1 commit intoanomalyco:devfrom
Br1an67 wants to merge 1 commit intoanomalyco:devfrom
Conversation
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.
Contributor
|
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 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 Note: The search results keep returning PR #15610 (the current PR), which is expected since it's the most relevant match. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #3340
Type of change
What does this PR do?
When
$SHELLis a POSIX-only shell (sh, dash, ash), brace expansion inmkdir -p src/{a,b,c}doesn't work — creating a literalsrc/{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 sofallback()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?
sh -c "mkdir -p /tmp/test/{a,b,c}"creates literal folder vsbash -c "mkdir -p /tmp/test/{a,b,c}"creates threefallback()priority chain: on Linux it triesBun.which("bash")first before falling to/bin/shScreenshots / recordings
N/A
Checklist