Hi!
I've discover this bug when trying to ':wq' in file with syntax errors using
syntastic plugin with
let g:syntastic_auto_loc_list=1
Instead of exiting from vim no matter there are syntax errors I got either
E855: Autocommands caused command to abort
or vim segfault.
To reproduce this bug it's enough to:
$ vi -u /dev/null --noplugin
:autocmd BufWinLeave * if empty(&bt) | lclose | endif
:lexpr system('echo :1:some')
:lopen
:wincmd p
:q
(location list closes; got message E855: Autocommands caused command to
abort; vim doesn't exit)
:q
(now vim exit)
Or, with tabs and segfault:
$ vi -u /dev/null --noplugin
:autocmd BufWinLeave * if empty(&bt) | lclose | endif
:tabnew
:lexpr system('echo :1:some')
:lopen
:wincmd p
:q
Vim: Caught deadly signal SEGV
Vim: Finished.
Segmentation fault
This happens on 7.3.515. Versions before 7.3.449 behave differently
without tabs, but with tabs they all crash.
There is probably bug in that autocmd -
&bt
should be replaced with
getbufvar(0+expand('<abuf>'), '&bt')
but it fix this issue only partially, in these cases:
- :lclose in location-list window
- :lclose in file window (with opened location-list)
- :q in location-list window
but we still got error (or segfault when tabs used) in this case:
- :q in file window (with opened location-list)
In last case expand('<abuf>') return file window's number, which is
correct IMO. In this situation doing :lclose looks correct and shouldn't
result in 'Autocommands caused command to abort'.
I've implemented workaround for syntastic:
https://github.com/scrooloose/syntastic/pull/256
but it's bug in vim and should be fixed in vim.
--
WBR, Alex.