You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Shadowing default echo with an alias/function can break autosuggestions #843
If the shell builtin "echo" is shadowed by an alias or a function, it is the alias/function that will be used by zsh-autosuggestions, which can break the autosuggestion by either printing a wrong suggestion, or executing an unwanted function.
To Reproduce
Steps to reproduce the behavior:
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
zsh -df
source~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
# example of printing the wrong suggestionalias echo="builtin echo 'DEBUG: '"# example of executing unwanted functionalias echo="ls; builtin echo 'DEBUG: '"
Expected behavior
I feel like zsh autosuggestions should always use the builtin echo, an being able to change the echo command is not a feature that could be beneficial.
Especially in src/async.zsh, the following "echo"s are vulnerable:
# Fork a process to fetch a suggestion and open a pipe to read from itbuiltinexec {_ZSH_AUTOSUGGEST_ASYNC_FD}<<(# Tell parent process our pidecho$sysparams[pid]# Fetch and print the suggestionlocal suggestion _zsh_autosuggest_fetch_suggestion "$1"echo -nE "$suggestion")
Screenshots
In the second screenshot, I believe the number 29970 comes from echo $sysparams[pid].
autosuggestions will be disabled entirely (no output at all).
So, thank you very much for helping to understand why it did not work at all for me (for so long).
Activity
Fruchix commentedon Nov 5, 2025
If this is indeed a bug I can review all
.zshfiles, force the usage ofbuiltin echoand submit a PR.chelovechishko commentedon Apr 1, 2026
Actually, with
autosuggestions will be disabled entirely (no output at all).
So, thank you very much for helping to understand why it did not work at all for me (for so long).
Use builtin echo to avoid conflicts with user aliases