From: Kazuhiro NISHIYAMA Date: 2010-01-27T08:44:48+09:00 Subject: [ruby-dev:40169] [Bug #2664] Failure: test_segv_test(TestRubyOptions) Bug #2664: Failure: test_segv_test(TestRubyOptions) http://redmine.ruby-lang.org/issues/show/2664 起票者: Kazuhiro NISHIYAMA ステータス: Open, 優先度: Normal カテゴリ: core ruby -v: ruby 1.9.2dev (2010-01-27 trunk 26434) [x86_64-linux] 環境によって「-- Ruby level backtrace information-----------------------------------------」が出たり出なかったりして、出る環境では test/ruby/test_rubyoptions.rb の test_segv_test が Failure になります。 % ruby-trunk -e 'Process.kill :SEGV, $$' 2>&1 | head -e:1: [BUG] Segmentation fault ruby 1.9.2dev (2010-01-27 trunk 26434) [x86_64-linux] -- control frame ---------- c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :kill c:0003 p:0019 s:0006 b:0006 l:002058 d:001bc8 EVAL -e:1 c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH c:0001 p:0000 s:0002 b:0002 l:002058 d:002058 TOP --------------------------- -- Ruby level backtrace information----------------------------------------- 出たり出なかったりする原因は rb_vm_bugreport の i が初期化されていないからのように見えます。 テストも含めて以下のような修正でどうでしょうか? Index: vm_dump.c =================================================================== --- vm_dump.c (revision 26436) +++ vm_dump.c (working copy) @@ -571,8 +571,8 @@ bugreport_backtrace(void *arg, VALUE file, int line, VALUE method) { if (!*(int *)arg) { - fprintf(stderr, "-- Ruby level backtrace information" - "-----------------------------------------\n"); + fprintf(stderr, "-- Ruby level backtrace information " + "----------------------------------------\n"); *(int *)arg = 1; } fprintf(stderr, "%s:%d:in `%s'\n", RSTRING_PTR(file), line, RSTRING_PTR(method)); @@ -586,7 +586,7 @@ rb_vm_bugreport(void) { if (GET_THREAD()->vm) { - int i; + int i = 0; SDR(); if (rb_backtrace_each(bugreport_backtrace, &i)) { Index: test/ruby/test_rubyoptions.rb =================================================================== --- test/ruby/test_rubyoptions.rb (revision 26436) +++ test/ruby/test_rubyoptions.rb (working copy) @@ -333,6 +333,7 @@ --\scontrol\sframe\s----------\n (?:c:.*\n)* ---------------------------\n + --\sRuby\slevel\sbacktrace\sinformation\s----------------------------------------\n -e:1:in\s`
'\n -e:1:in\s`kill'\n\n (?: ---------------------------------------- http://redmine.ruby-lang.org