zsh-autosuggestions: Segfault after sourcing zshrc again - conflict with zsh-autosuggestions even when sourced in right order.
Hi, this issue is similar to issue #96:
After opening zsh and sourcing .zshrc, zsh exits with “zsh: segmentation fault zsh”:
% zsh
% . ~/.zshrc
zsh: segmentation fault zsh
Issue #96 was solved by sourcing zsh-autosuggestions before zsh-syntax-highlighting, but that solution no longer works. Zsh segfaults no matter their order.
Here’s the .zshrc file:
source ~/bin/zsh/antigen/antigen.zsh
antigen bundle tarruda/zsh-autosuggestions
antigen bundle zsh-users/zsh-syntax-highlighting
antigen apply
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 6
- Comments: 25 (10 by maintainers)
Commits related to this issue
- Gracefully handle being sourced multiple times Should fix #126 — committed to zsh-users/zsh-autosuggestions by ericfreese 7 years ago
- Fix issues with widgets wrapped by other plugins Puts in a better fix for #126 and related issues. — committed to zsh-users/zsh-autosuggestions by ericfreese 7 years ago
- Fix issues with widgets wrapped by other plugins Puts in a better fix for #126 and related issues. — committed to zsh-users/zsh-autosuggestions by ericfreese 7 years ago
- Fix issues with widgets wrapped by other plugins Puts in a better fix for #126 and related issues. — committed to zsh-users/zsh-autosuggestions by ericfreese 7 years ago
- Remove workaround. zsh-autosuggestions 0.4.0: Gracefully handle being sourced multiple times (#126). https://github.com/zsh-users/zsh-autosuggestions/issues/126. — committed to seagle0128/dotfiles by seagle0128 7 years ago
- Fix issue where partial accept duplicates last word When z-sy-h is enabled after autosuggestion widgets have already been bound, partial accepting the last part of a suggestion will result in that st... — committed to zsh-users/zsh-autosuggestions by ericfreese 4 years ago
- Fix issue where partial accept duplicates last word When z-sy-h is enabled after autosuggestion widgets have already been bound, partial accepting the last part of a suggestion will result in that st... — committed to zsh-users/zsh-autosuggestions by ericfreese 4 years ago
- Fix issue where partial accept duplicates last word When z-sy-h is enabled after autosuggestion widgets have already been bound, partial accepting the last part of a suggestion will result in that st... — committed to zsh-users/zsh-autosuggestions by ericfreese 4 years ago
I’m still experiencing a similar problem - starting the shell the first time is no problem, only when I manually
source ~/.zshrcthe formatting of suggestion is broken (the same as typed letters). The problem occurs only when using zsh-syntax-highlighting and zsh-autosuggestions together.For any/all that continue to have problems with this. This is my work around. NOTE that I am using oh-my-zsh with repos loaded in
.oh-my-zsh/custom/plugins@ericfreese The following patch fixes the problem for me and keeps both z-asug and z-sy-h working. Why does z-asug reinstall itself at every precmd?
edit (to users who want to test this patch): Remember to run
makeafter applying this patch!This is only when sourcing the .zshrc for the second time correct?
I.e. You don’t get a segfault if you do this?
I’ve been experimenting a bit.
Some test cases:
A) Sourcing only this plugin multiple times (no segfault)
B) Sourcing only the
zsh-syntax-highlightingplugin multiple times (no segfault)C) Sourcing
zsh-syntax-highlightingmultiple times, then this plugin multiple times (no segfault)D) Sourcing this plugin (any number of times), then
zsh-syntax-highlighting(segfault)E) Sourcing both plugins at the same command prompt (see https://github.com/tarruda/zsh-autosuggestions/issues/107#issuecomment-183822932) (no segfault)
So, yes there is some sort of bug here. I’ll look into exactly what triggers these segfaults and see if there’s something we can do in this plugin to avoid them.
In the mean time, the obvious workaround is to not source these plugins at different prompts. Just put them in your .zshrc and only source them once. Start a new terminal session when making changes to your config instead of sourcing your .zshrc again.
Yeah! This works well:
When to expect this in master?
To everyone who says the workaround https://github.com/zsh-users/zsh-autosuggestions/issues/126#issuecomment-217041261 doesn’t work for them: note that you need to run
makeafter applying that patch!Is there any solution for this? The workaround doesn’t work for me