SIGSEGV when opening c/cpp/h files

No matter whether opening a new file or an existing file, each of the following commands

vi somecfile.c
vi somecppfile.cpp
vi someheader.h

result in:

Vim: Caught deadly signal SEGV
Vim: Finished.

Vi only shows up for a fraction of a second.

backtrace from GDB:

#0  0x00007fffead86391 in boost::filesystem::detail::directory_iterator_construct(boost::filesystem::directory_iterator&, boost::filesystem::path const&, boost::system::error_code*) ()
    at /usr/lib/x86_64-linux-gnu/
#1  0x00007fffe8905b78 in color_coded::conf::find(boost::filesystem::path, std::string const&) () at /home/tsp/.vim/bundle/color_coded/
#2  0x00007fffe891f4a9 in color_coded::core::queue()::{lambda(color_coded::async::task const&)#1}::operator()(color_coded::async::task const&) const () at /home/tsp/.vim/bundle/color_coded/
#3  0x00007fffe891faed in std::_Function_handler<:async::result const color_coded::core::queue>::_M_invoke(std::_Any_data const&, color_coded::async::task const&) () at /home/tsp/.vim/bundle/color_coded/
#4  0x00007fffe890c71d in color_coded::async::queue<:async::task color_coded::async::result>::work() () at /home/tsp/.vim/bundle/color_coded/
#5  0x00007fffebce283f in  () at /usr/lib/x86_64-linux-gnu/
#6  0x00007ffff3fc46da in start_thread (arg=0x7fffe4d59700) at pthread_create.c:456
#7  0x00007ffff2e40d7f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:105

My vim version:

vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Mar 17 2017 12:13:35)
Included patches: 1-95
Modified by
Compiled by
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     +tcl
+balloon_eval    +folding         +mouse_xterm     +termguicolors
+browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +gettext         -mzscheme        +textobjects
+channel         -hangul_input    +netbeans_intg   +timers
+cindent         +iconv           +num64           +title
+clientserver    +insert_expand   +packages        +toolbar
+clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        +perl            +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       -python          +vreplace
+cscope          +lispindent      +python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con_gui  +lua             +rightleft       +writebackup
+diff            +menu            +ruby            +X11
+digraphs        +mksession       +scrollbind      -xfontset
+dnd             +modify_fname    +signs           +xim
-ebcdic          +mouse           +smartindent     +xpm
+emacs_tags      +mouseshape      +startuptime     +xsmp_interact
+eval            +mouse_dec       +statusline      +xterm_clipboard
+ex_extra        +mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax
+farsi           +mouse_netterm   +tag_binary
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/mirclient -I/usr/include/mircore -I/usr/include/mircookie -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Wdate-time  -g -O2 -fdebug-prefix-map=/build/vim-8krYYf/vim-8.0.0095=. -fPIE -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E  -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl  -L/usr/lib -llua5.2 -Wl,-E  -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/x86_64-linux-gnu/perl/5.24/CORE -lperl -ldl -lm -lpthread -lcrypt  -L/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu -lpython3.5m -lpthread -ldl -lutil -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lieee -lm -lruby-2.3 -lpthread -lgmp -ldl -lcrypt -lm

Very importantly, this problem does not happen when removing color_coded.

I am running a fresh install of Ubuntu 17.04 with the following vimrc

set nocompatible
filetype off

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'jeaye/color_coded'
call vundle#end()
filetype plugin indent on

I have the same issue on my 2nd machine (also Ubuntu 17.04).

The symptoms are the same as in, but the stack trace is different and clang is 3.9.

I believe this issue could be related to, because I also get an invalid free whenever I close vim (except with c, cpp, h files because I don't even get to open them)

In case the two issues are indeed related, here is the output of valgrind when closing vim:

valgrind vi
==19221== Memcheck, a memory error detector
==19221== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==19221== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==19221== Command: vi
--19221-- WARNING: unhandled amd64-linux syscall: 324
--19221-- You may be able to write your own handler.
--19221-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--19221-- Nevertheless we consider this a bug.  Please report
--19221-- it at
==19221== Invalid free() / delete / delete[] / realloc()
==19221==    at 0x4C2F25B: operator delete(void*) (in /usr/lib/valgrind/
==19221==    by 0x9B4C26F: __run_exit_handlers (exit.c:83)
==19221==    by 0x9B4C2C9: exit (exit.c:105)
==19221==    by 0x26D5BA: mch_exit (in /usr/bin/vim.gtk3)
==19221==    by 0x34680E: getout (in /usr/bin/vim.gtk3)
==19221==    by 0x1CB898: ??? (in /usr/bin/vim.gtk3)
==19221==    by 0x1D24EE: do_cmdline (in /usr/bin/vim.gtk3)
==19221==    by 0x244244: ??? (in /usr/bin/vim.gtk3)
==19221==    by 0x24DC94: normal_cmd (in /usr/bin/vim.gtk3)
==19221==    by 0x347604: main_loop (in /usr/bin/vim.gtk3)
==19221==    by 0x34877F: vim_main2 (in /usr/bin/vim.gtk3)
==19221==    by 0x16B420: main (in /usr/bin/vim.gtk3)
==19221==  Address 0x14139d88 is 24 bytes inside a block of size 27 alloc'd
==19221==    at 0x4C2E19F: operator new(unsigned long) (in /usr/lib/valgrind/
==19221==    by 0x10D34138: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib/x86_64-linux-gnu/
==19221==    by 0x10D34256: ??? (in /usr/lib/x86_64-linux-gnu/
==19221==    by 0x10D36055: std::basic_string<char std::char_traits>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib/x86_64-linux-gnu/
==19221==    by 0x15096913: _GLOBAL__sub_I_path.cpp (in /home/tsp/.vim/bundle/color_coded/
==19221==    by 0x40109C9: call_init.part.0 (dl-init.c:72)
==19221==    by 0x4010ADA: call_init (dl-init.c:30)
==19221==    by 0x4010ADA: _dl_init (dl-init.c:120)
==19221==    by 0x4015A75: dl_open_worker (dl-open.c:575)
==19221==    by 0x4010873: _dl_catch_error (dl-error.c:187)
==19221==    by 0x4015058: _dl_open (dl-open.c:660)
==19221==    by 0x8217EE8: dlopen_doit (dlopen.c:66)
==19221==    by 0x4010873: _dl_catch_error (dl-error.c:187)
==19221== HEAP SUMMARY:
==19221==     in use at exit: 2,645,390 bytes in 25,047 blocks
==19221==   total heap usage: 92,995 allocs, 67,952 frees, 43,489,053 bytes allocated
==19221== LEAK SUMMARY:
==19221==    definitely lost: 0 bytes in 0 blocks
==19221==    indirectly lost: 0 bytes in 0 blocks
==19221==      possibly lost: 339,968 bytes in 5,681 blocks
==19221==    still reachable: 2,305,422 bytes in 19,366 blocks
==19221==                       of which reachable via heuristic:
==19221==                         stdstring          : 106 bytes in 4 blocks
==19221==                         newarray           : 1,536 bytes in 16 blocks
==19221==         suppressed: 0 bytes in 0 blocks
==19221== Rerun with --leak-check=full to see details of leaked memory
==19221== For counts of detected and suppressed errors, rerun with: -v
==19221== ERROR SUMMARY: 4 errors from 1 contexts (suppressed: 0 from 0)

Where one line is color_coded related: ==19221== by 0x15096913: _GLOBAL__sub_I_path.cpp (in /home/tsp/.vim/bundle/color_coded/


2020/11/22 07:55
  • 点赞
  • 收藏
  • 回答