Conversation
Fixes edc#105. `eval $1` is unquoted, so bash performs word splitting and pathname expansion on the command string before `eval` parses it. Quoting that is correct *for bash* therefore does not survive the round trip: bass printf "'[%s]\n'" "'a b'" -> [a b] (one space) bass printf "'[%s]\n'" "'*'" -> expanded against the cwd `eval "$1"` hands the string to eval intact, and both cases behave as the quoting asks: `[a b]`, and `[*]`. This deliberately does not change bass's contract that unquoted arguments form a bash command line -- `bass source ~/.nvm/nvm.sh ';' nvm use iojs` still relies on `';'` reaching bash as a separator, and an unquoted `*` is still a glob. The only difference is that quoting is no longer stripped before bash can honour it. The new test asserts both symptoms and fails on the unpatched version. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
eval $1in__bass.pyis unquoted, so bash performs word splitting and pathnameexpansion on the command string before
evalparses it. Quoting that is correct forbash therefore does not survive the round trip.
With
eval "$1"the string reaches eval intact and both behave as the quoting asks:[a b], and[*].This is #105. It shows up whenever a caller quotes properly on the fish side — which is
what a fish wrapper around bass has to do, since fish strips its own quotes before bass
ever sees the arguments.
What this deliberately does not change
bass's contract is that its arguments form a bash command line, and that stays true:
bass source ~/.nvm/nvm.sh --no-use ';' nvm use iojsstill works —';'reaches bashas a separator, exactly as the README documents.
*is still a glob, because at that point it is shell syntax the callerwrote, not data.
The only difference is that quoting is no longer stripped before bash can honour it.
Test
test/test_quoted_arguments.fishasserts both symptoms and is wired intomake test. Itfails on the unpatched version (no
Success, exit 1) and passes with the change. The fourexisting tests still pass.