Conversation
The profile helpers wrapped the whole line in literal single quotes, so a value containing one closed the string early and the emitted command was a syntax error that wrote nothing. The pwsh branch already quoted the line through pwsh_quote; sh_single_quote gives the Bourne, rc, csh and fish branches the same treatment.
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.
brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Follow-up to #24035, which named this as the part it deliberately left alone.
set_variable_in_profileandprepend_path_in_profilebuild a command for the user to paste, wrapping the whole profile line in literal single quotes. A single quote in the value closes that string early:Nothing is written. The
\thatsh_quoteadds is literal inside single quotes, so it does not escape anything; a single-quoted string can only be interrupted, escaped and resumed.The pwsh branch already passes its whole line through
pwsh_quote.sh_single_quotedoes the same for the Bourne, rc, csh and fish branches.Emitting the command for five values (apostrophe, space,
$, double quote, plain) under bash, zsh, sh, ksh and tcsh, then running it and sourcing the profile it writes: before, the five apostrophe cases fail to run at all, one per shell; after, all 30 run and source back the exact value. The output is byte-identical to today's for every value that does not contain a quote, so nothing that works now changes.Reachable wherever
HOMEBREW_PREFIXor a keg path contains an apostrophe, which on Linux means a home-directory install for someone whose username has one. The callers arebrew linkfor keg-only formulae, the keg-only caveats, and theHOMEBREW_TEMPadvice in the Linux diagnostic.Three new examples, one per changed behaviour; reverting only
utils/shell.rbfails exactly those three and nothing else.brew testsalso passes forcaveats,diagnostic,cmd/linkandcmd/--env.rcis covered by the same change but I have norcto run it under, so that branch is reasoned from the sharedecho '...'shape rather than measured. Saying so rather than implying I tested it.AI disclosure: written with Claude Code (Claude Opus 5) on my account. The before/after counts come from a harness that ran each emitted command in the real shell and sourced the profile it produced. I answer review comments myself.