-
-
Notifications
You must be signed in to change notification settings - Fork 769
fix: properly quote exe in bash activate #7070
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes shell escaping in bash activation scripts by properly escaping the executable path before interpolation, rather than blindly wrapping it in quotes during interpolation. The change uses shell_escape::unix::escape() to handle special characters in the exe path correctly.
Key changes:
- Added pre-escaping of the
exevariable usingshell_escape::unix::escape() - Removed hard-coded quotes around all
{exe}interpolations in the generated bash script - Applied the same escaping pattern already used by
set_env()andunset_env()methods
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
bugbot run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no bugs!
|
@cspotcode Could you check if this alternative implementation also solves the problem for you? |
|
@jdx would be good to wait for someone with Windows to confirm. I just saw this while working in this area for a separate reason |
|
I can't, don't have time. I don't see why it wouldn't work. A failing test we can try is if the path to mise contains a single-quote in the path, like if someone installs it into a directory named We can also update the escaping used for other |
|
I'm confident this handles the single quote. I just don't have any experience in the windows world that inspired the other pr. |
I looked at this but each shell has its own quoting rules, and they aren't all compatible with This PR is just to fix a recently-introduced wart in the bash implementation. I am confident in the correctness of this change for Bash. My reason for pause is that the previous fix was targeted at a Windows-specific problem. But having said that, I'm pretty sure it's fine. |
Blindly wrapping an interpolated value in quotes is an anti-pattern. Properly quote the value prior to interpolation, instead.
Replaces commit 4a9ec4e from #7002
Note
Escapes the interpolated
exefor bash activation and updates command invocations to use the escaped value without extra quotes.exeviashell_escape::unix::escapebefore interpolation insrc/shell/bash.rs.{exe}without surrounding quotes:mise()function (zero-arg path, eval path, and general command path).command_not_found_handlehook.Written by Cursor Bugbot for commit 728e8ae. This will update automatically on new commits. Configure here.