Remove band-aid - opening a file in unception can cause a segfault in seemingly rare circumstances.
The bug appears very inconsistently, and I've only been able to produce it on Arch Linux. I'm unsure if the error lies within Neovim core, Lazy, unception, or elsewhere. It seems to occur more frequently when more plugins are installed, regardless of what the plugins are. If only unception is installed, I simply cannot reproduce it.
I can fairly consistently get it to occur with this config.
I've only been able to get it to occur when g:unception_delete_replaced_buffer is set to true.
Steps to reproduce:
- Install unception along with some other plugins (I don't believe it really matters what they are). The config provided above can be used (though be sure to open Neovim once regularly to ensure that all of the plugins are bootstrapped/installed).
- Navigate to a directory in bash.
- Create a file called
test.txtby running:echo 'hi' > test.txt - Run the following command:
This simply opens a new terminal buffer, and tries to open test.txt from inside of it.nvim -c "terminal" -c "execute feedkeys(\"invim test.txt\<CR>\")" - Observe segfault (occasionally).
May be related to https://github.com/neovim/neovim/issues/10386?
Added a simple check that appears to prevent this from occurring during normal usage in #64. Leaving this open, because I'd like to remove the code should Neovim core get updates that fix the issue.
Note that this now means that if you have g:unception_delete_replaced_buffer set to true, and you have a single terminal split, and therefore visible in more than one window, if you try to open a file in the current window by running nvim filename, you'll now launch a nested session in one of the windows, and open a file in the other. I'm not sure there's a good way around this until the above Neovim core issue is fixed?