From: Ryan Davis Date: 2004-03-10T13:44:11+09:00 Subject: bus error in eval.c I found a bus error while debugging a pathological case between 1.6 and 1.8 that makes my code run 100x slower in 1.8. I think I have the proper patch for it. WOOT. I just found the minimally reproducible test case: class Hash alias :old_inspect :inspect def inspect raise "no" end end eval "{}.blah" I've gotten this to work on ruby 1.8.1 (from cvs) on both macosx/darwin and freebsd. gdb shows: > Program received signal EXC_BAD_ACCESS, Could not access memory. > eval (self=5880980, src=5880500, scope=4, file=0x87798 "(eval)", > line=1) at eval.c:6052 > 6052 rb_str_update(mesg, 0, 0, > RARRAY(errat)->ptr[0]); > > (gdb) bt > #0 eval (self=5880980, src=5880500, scope=4, file=0x87798 "(eval)", > line=1) at eval.c:6052 > #1 0x0000f6f8 in rb_f_eval (argc=-1073872096, argv=0x4065c2, > self=5880980) at eval.c:6118 > #2 0x0000dbd8 in rb_call0 (klass=1936544, recv=5880980, id=3905, > oid=3905, argc=1, argv=0xbffe0820, body=0x1d7288, nosuper=0) at > eval.c:5429 > #3 0x0000e518 in rb_call (klass=1936544, recv=5880980, mid=3905, > argc=1, argv=0xbffe0820, scope=1) at eval.c:5650 > # ... > (gdb) p errat > $1 = 4 ruby.h says that Qnil = 4. Here is my patch: *** eval.c.~1.616.2.14.~ Wed Mar 3 11:01:01 2004 --- eval.c Tue Mar 9 20:29:01 2004 *************** *** 6049,6055 **** mesg = rb_attr_get(ruby_errinfo, rb_intern("mesg")); if (!NIL_P(mesg) && TYPE(mesg) == T_STRING) { rb_str_update(mesg, 0, 0, rb_str_new2(": ")); ! rb_str_update(mesg, 0, 0, RARRAY(errat)->ptr[0]); } RARRAY(errat)->ptr[0] = RARRAY(backtrace(-2))->ptr[0]; } --- 6049,6057 ---- mesg = rb_attr_get(ruby_errinfo, rb_intern("mesg")); if (!NIL_P(mesg) && TYPE(mesg) == T_STRING) { rb_str_update(mesg, 0, 0, rb_str_new2(": ")); ! if (!NIL_P(errat) && TYPE(errat) == T_ARRAY) { ! rb_str_update(mesg, 0, 0, RARRAY(errat)->ptr[0]); ! } } RARRAY(errat)->ptr[0] = RARRAY(backtrace(-2))->ptr[0]; } I could also see both conditionals being merged...