ycm-core / YouCompleteMe

A code-completion engine for Vim
http://ycm-core.github.io/YouCompleteMe/
GNU General Public License v3.0
25.45k stars 2.81k forks source link

Segmentation fault in .rb files #1312

Closed danstn closed 9 years ago

danstn commented 9 years ago

Scenario:

Results in the following:

$ vim test.rb                                                       
Vim: Caught deadly signal SEGV
Vim: preserving files...
Vim: Finished.

Disabling Plugin 'Valloric/YouCompleteMe' fixes the problem.

Using YCM with ultisnips and vim-snippets

Running on OSX Yosemite

$ vim --version                                                                                                                                                                                                                                                                                                    [13:32:21]
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec 26 2014 01:45:27)
MacOS X (unix) version
Included patches: 1-488
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
-balloon_eval    +float           +mouse_urxvt     -tag_any_white
-browse          +folding         +mouse_xterm     -tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         -gettext         -mzscheme        +textobjects
-clientserver    -hangul_input    +netbeans_intg   +title
+clipboard       +iconv           +path_extra      -toolbar
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      -lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
+emacs_tags      -mouseshape      -sniff           -xsmp
+eval            +mouse_dec       +startuptime     -xterm_clipboard
+ex_extra        -mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    -xpm
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -F/usr/local/Frameworks -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -DMACOS_X_UNIX  -Os -w -pipe -march=native -mmacosx-version-min=10.10 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/clang   -L. -L/Users/mpapis/.sm/pkg/active/lib -fPIC -Bstatic -fstack-protector -L/usr/local/lib -F/usr/local/Frameworks -Wl,-headerpad_max_install_names -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -o vim        -lm  -lncurses -liconv -framework Cocoa   -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl -framework Python   -lruby-static -framework CoreFoundation -lobjc -L/Users/daniel/.rvm/rubies/ruby-2.1.5/lib
Printing YouCompleteMe debug information...
-- Server has Clang support compiled in: True
-- Clang version: clang version 3.5.0 (tags/RELEASE_350/final)
-- Server running at: http://127.0.0.1:52656
-- Server process ID: 70916
danstn commented 9 years ago

UPDATE: This does not happen when editing Js/C for example. (vim test.js or vim test.c)

vheon commented 9 years ago

I just tried with ruby files and nothing bad happen. So apparently is a problem with your configuration. Closing

matipan commented 9 years ago

Hey there, i've been having the exact same problem. If you have vim-ruby plugin installed, then you need to apply this changes to the vim-ruby/autoload/rubycomplete.vim file. The problem is that vim-ruby tries to call instance_methods function in any variable, according to it's type, so when you do some like this:

some_var = gets.chomp
some_var.(here is were it'll stop working)

vim-ruby will try to come up with a list of instance_methods for a variable of vartype "gets". There is were it breaks. But if you do the changes that are in that pull request(they haven't merged it yet, but it's been over 6 months so i don't think they will) everything will work. Hope this fixes your issue!!