-
Notifications
You must be signed in to change notification settings - Fork 370
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
fix: Fixes infinite loop in auto install not found bash function #4094
Conversation
This infinite loop bug is triggered when mise itself becomes not found, e.g., by deleting the directory mise is in.
Tests failed because I didn't update the test snap, I did that now. However, this made me realize that this'll need fixing for the other shells too, which I am not proficient in. |
The remaining test failure, related to
|
src/shell/bash.rs
Outdated
@@ -71,7 +71,7 @@ impl Shell for Bash { | |||
fi | |||
|
|||
command_not_found_handle() {{ | |||
if {exe} hook-not-found -s bash -- "$1"; then | |||
if [ "$1" != "mise" ] && {exe} hook-not-found -s bash -- "$1"; then |
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.
this should match this logic
Line 95 in 801a880
&& (*env::MISE_BIN_NAME == mise_bin || env::MISE_BIN_NAME.starts_with("mise-")) |
I'd like at least support for zsh (which should be close to bash), fish would also be quite nice but the others I'm not so concerned about, I don't even think most of them have not_found handlers |
I didn't check whether the |
I am assuming either the tests cover this enough or you tested a bit 🤣 |
An error for `fish_command_not_found` was introduce in jdx#4094 because glob misses do not work the same in fish as in other shells. As such, we are getting the following error on an unknown function: ``` - (line 64): No matches for wildcard '"mise-"*'. See `help wildcards-globbing`. if test "$argv[1]" != "mise" -a "$argv[1]" != "mise-"* ``` This has been replaced with a fish-specific implementation test that prevents the error and is somewhat more idiomatic as well.
An error for `fish_command_not_found` was introduce in #4094 because glob misses do not work the same in fish as in other shells. As such, we are getting the following error on an unknown function: ``` - (line 64): No matches for wildcard '"mise-"*'. See `help wildcards-globbing`. if test "$argv[1]" != "mise" -a "$argv[1]" != "mise-"* ``` This has been replaced with a fish-specific implementation test that prevents the error and is somewhat more idiomatic as well.
This infinite loop bug is triggered when
mise
itself becomes not found, e.g., by deleting the directorymise
is in.Here's some output of the shell with
set -x
on when doingrm -rf
on the directory (workspace/
) containingmise
in some subpath: