Hi,

When vim start the ruby interpreter, any runtime error may cause a core dump.

To reproduce, put a bad environment variable looked by ruby:
    % RUBYOPT='-r /not_extists' vim --cmd 'ruby 0'
    Vim: Caught deadly signal SEGV
    Vim: Finished.
    [1]    32583 segmentation fault (core dumped)  RUBYOPT=-r/ VIM=./runtime 
src/vim -u NONE --cmd 'ruby 0'

    % gdb                                                                       
                                                          :(
    [...]
    (gdb) bt
    #0  0x00007fcb6381d937 in kill () from /usr/lib/libc.so.6
    #1  0x000000000050b703 in may_core_dump () at os_unix.c:3389
    #2  0x000000000050cc48 in may_core_dump () at os_unix.c:3346
    #3  mch_exit (r=1) at os_unix.c:3355
    #4  <signal handler called>
    #5  rb_threadptr_tag_jump (st=st@entry=6, th=<optimized out>, th=<optimized 
out>) at eval_intern.h:161
    #6  0x00007fcb63f853e9 in vm_exec (th=th@entry=0x85d2f0) at vm.c:1771
    #7  0x00007fcb63f886aa in vm_call0_body (th=0x85d2f0, 
calling=calling@entry=0x7ffe49152450, ci=ci@entry=0x7ffe49152440, 
cc=cc@entry=0x7ffe49152470, argv=argv@entry=0x7ffe491524f8) at vm_eval.c:182
    #8  0x00007fcb63f88d34 in vm_call0 (me=0xb5b0f8, argv=0x7ffe491524f8, 
argc=1, id=19777, recv=9168520, th=<optimized out>) at vm_eval.c:61
    #9  rb_call0 (recv=recv@entry=9168520, mid=mid@entry=19777, 
argc=argc@entry=1, argv=argv@entry=0x7ffe491524f8, 
scope=scope@entry=CALL_FCALL, self=<optimized out>) at vm_eval.c:351
    #10 0x00007fcb63f8943a in rb_call (scope=CALL_FCALL, 
argv=argv@entry=0x7ffe491524f8, argc=argc@entry=1, mid=mid@entry=19777, 
recv=recv@entry=9168520) at vm_eval.c:844
    #11 rb_funcallv (recv=recv@entry=9168520, mid=mid@entry=19777, 
argc=argc@entry=1, argv=argv@entry=0x7ffe491524f8) at vm_eval.c:845
    #12 0x00007fcb63efe6a1 in require_libraries 
(req_list=req_list@entry=0x7ffe49153668) at ruby.c:572
    #13 0x00007fcb63f02cd9 in process_options (argc=0, argc@entry=2, 
argv=0x7ffe491536c0, argv@entry=0x7ffe491536b0, opt=opt@entry=0x7ffe491535f0) 
at ruby.c:1516
    #14 0x00007fcb63f02f40 in ruby_process_options (argc=argc@entry=2, 
argv=argv@entry=0x7ffe491536b0) at ruby.c:2066
    #15 0x0000000000594233 in ensure_ruby_initialized () at if_ruby.c:820
    #16 0x0000000000595525 in ex_ruby (eap=0x7ffe491538d0) at if_ruby.c:665
    #17 0x00000000004826b2 in do_one_cmd (cookie=0x0, fgetline=0x0, 
cstack=0x7ffe49153980, sourcing=1, cmdlinep=0x7ffe49153808) at ex_docmd.c:2961
    #18 do_cmdline (cmdline=<optimized out>, fgetline=fgetline@entry=0x0, 
cookie=cookie@entry=0x0, flags=flags@entry=11) at ex_docmd.c:1133
    #19 0x000000000048695e in do_cmdline_cmd (cmd=<optimized out>) at 
ex_docmd.c:738
    #20 0x0000000000427fc9 in exe_pre_commands (parmp=0x7ffe49153ed0) at 
main.c:2894
    #21 main (argc=<optimized out>, argv=<optimized out>) at main.c:623
    (gdb)

I tried with version 1.9.3, 2.0.x, 2.1.x and 2.3.x of ruby , same issue for all.
Using ruby_options() instead ruby_process_options() fix this for me, ruby catch 
this exception.
I not known if is best solution, but this improve the diagnostic.

Thanks

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/if_ruby.c b/src/if_ruby.c
index ac23878..5d3089d 100644
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -280,7 +280,7 @@ static void ruby_vim_init(void);
 #  define rb_enc_str_new			dll_rb_enc_str_new
 #  define rb_sprintf			dll_rb_sprintf
 #  define rb_require			dll_rb_require
-#  define ruby_process_options		dll_ruby_process_options
+#  define ruby_options			dll_ruby_options
 # endif
 
 /*
@@ -384,7 +384,7 @@ static rb_encoding* (*dll_rb_enc_find) (const char*);
 static VALUE (*dll_rb_enc_str_new) (const char*, long, rb_encoding*);
 static VALUE (*dll_rb_sprintf) (const char*, ...);
 static VALUE (*dll_rb_require) (const char*);
-static void* (*ruby_process_options)(int, char**);
+static void* (*ruby_options)(int, char**);
 # endif
 
 # if defined(USE_RGENGC) && USE_RGENGC
@@ -565,7 +565,7 @@ static struct
     {"rb_enc_str_new", (RUBY_PROC*)&dll_rb_enc_str_new},
     {"rb_sprintf", (RUBY_PROC*)&dll_rb_sprintf},
     {"rb_require", (RUBY_PROC*)&dll_rb_require},
-    {"ruby_process_options", (RUBY_PROC*)&dll_ruby_process_options},
+    {"ruby_options", (RUBY_PROC*)&dll_ruby_options},
 # endif
 # if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK)
 #  ifdef __ia64
@@ -817,7 +817,7 @@ static int ensure_ruby_initialized(void)
 	    {
 		int dummy_argc = 2;
 		char *dummy_argv[] = {"vim-ruby", "-e0"};
-		ruby_process_options(dummy_argc, dummy_argv);
+		ruby_options(dummy_argc, dummy_argv);
 	    }
 	    ruby_script("vim-ruby");
 #else

Raspunde prin e-mail lui