-
Notifications
You must be signed in to change notification settings - Fork 210
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
Ubuntu' "command not found" breaks when "mise activate" is added to .bashrc #1557
Comments
I might've found the problem, but I don't know how to fix it well. [ -n "$(declare -f command_not_found_handler)" ] && eval "${{$(declare -f command_not_found_handler)/command_not_found_handler/_command_not_found_handler}}" The solution is probably something along the lines of this: [ -n "$(declare -f command_not_found_handle)" ] && eval "${{$(declare -f command_not_found_handle)/command_not_found_handle/_command_not_found_handle}}" Bash considers the command-not-found handle to be I'll test this in a bit... |
huh yeah looks like you're right. That's incredibly confusing. I tested this but that (I think) was by manually creating |
Fixes #1557 Also refactored all the shell activate scripts
Fixes #1557 Also refactored all the shell activate scripts
Fixes #1557 Also refactored all the shell activate scripts
* fix bash not_found handler Fixes #1557 Also refactored all the shell activate scripts * Commit from GitHub Actions (test) --------- Co-authored-by: mise[bot] <123107610+mise-en-dev@users.noreply.github.com>
@jdx Seems there's a different Bash-related quirk now, it's printing this line when I launch the terminal. I think I figured it out though.
I've done some modification on a copy of the activate script and I think this modification to the hook might fix it. Seems like Bash doesn't seem to do command substitution inside string substitution. diff --git a/src/shell/bash.rs b/src/shell/bash.rs
index 31b9d81d..978c3ca2 100644
--- a/src/shell/bash.rs
+++ b/src/shell/bash.rs
@@ -48,7 +48,8 @@ impl Shell for Bash {
out.push_str(&formatdoc! {r#"
if [ -z "${{_mise_cmd_not_found:-}}" ]; then
_mise_cmd_not_found=1
- [ -n "$(declare -f command_not_found_handle)" ] && eval "${{$(declare -f command_not_found_handle)/command_not_found_handle/_command_not_found_handle}}"
+ _mise_cmd_not_found_handle=$(declare -f command_not_found_handle)
+ [ -n "$_mise_cmd_not_found_handle" ] && eval "${{_mise_cmd_not_found_handle/command_not_found_handle/_command_not_found_handle}}"
command_not_found_handle() {{
if {exe} hook-not-found -s bash -- "$1"; then The output of |
Describe the bug
When mise is activated in
$HOME/.bashrc
, user does not get a recommendation for a Ubuntu command that is not installed.To Reproduce
Activate mise on bash using
$HOME/.bashrc
using Ubuntu 23.10.Expected behavior
When mise is activated in
$HOME/.bashrc
, user should get a command recommendation bycommand-not-found
package for packages that aren't present.mise doctor
outputAdditional context
When running "smartctl" with it not installed:
Actual:
Expected:
The text was updated successfully, but these errors were encountered: