nvim-unception icon indicating copy to clipboard operation
nvim-unception copied to clipboard

Remove band-aid - opening a file in unception can cause a segfault in seemingly rare circumstances.

Open samjwill opened this issue 3 years ago • 3 comments

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.txt by running:
    echo 'hi' > test.txt
    
  • Run the following command:
    nvim -c "terminal" -c "execute feedkeys(\"invim test.txt\<CR>\")"
    
    This simply opens a new terminal buffer, and tries to open test.txt from inside of it.
  • Observe segfault (occasionally).

samjwill avatar Jan 16 '23 18:01 samjwill

May be related to https://github.com/neovim/neovim/issues/10386?

samjwill avatar Mar 10 '23 17:03 samjwill

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.

samjwill avatar Mar 10 '23 18:03 samjwill

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?

samjwill avatar Mar 20 '23 00:03 samjwill