[Bug:1.9] removing Exception#initialize dumps core


#1

e$B1sF#$G$9!#e(B

e$B0J2<$Ge(B SEGV e$B$7$^$9$,!";EMM$G$7$g$&$+!#e(B

$ ./ruby -e ‘class Exception; remove_method(:initialize); end; raise’
-e:1: warning: removing `initialize’ may cause serious problem
e$B%;%0%a%s%F!<%7%g%s0cH?$G$9e(B


#2

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:36993] [Bug:1.9] removing Exception#initialize
dumps core”
on Thu, 30 Oct 2008 02:35:10 +0900, “Yusuke ENDOH” removed_email_address@domain.invalid
writes:

|e$B0J2<$Ge(B SEGV e$B$7$^$9$,!";EMM$G$7$g$&$+!#e(B
|
|$ ./ruby -e ‘class Exception; remove_method(:initialize); end; raise’
|-e:1: warning: removing `initialize’ may cause serious problem
|e$B%;%0%a%s%F!<%7%g%s0cH?$G$9e(B

e$B$J$K$,5/$-$F$k$+$H$$$&$He(B

  • raisee$B$GNc30%*%V%8%’%/%H$r:n$m$&$H$9$ke(B
  • Exception#initializee$B$,:o=|$5$l$F$$$k$N$Ge(B
    BasicObject#initializee$B$r8F$Ve(B
  • BasicObject#initializee$B$O0z?t$r<h$i$J$$$N$G0z?t$N?t$,$"$oe(B
    e$B$:e(BArgumentError e$B$,H/@8$9$ke(B(raisee$B$9$ke(B)
  • raisee$B$GNc30%*%V%8%’%/%H$r:n$m$&$H$9$ke(B
  • e$B0J2<7+$jJV$7!#L58B:F5"$G%9%?%C%/$r;H$$$-$C$Fe(BSEGV

e$B$G$9!#e(BBasicObject#initializee$B$rG$0U8D$N0z?t$r<u$1IU$1$ke(B(e$B$G!“L5e(B
e$B;k$9$ke(B)e$B$h$&$K$9$l$P!”$3$NLdBj$O$J$/$J$j$^$9$,!"$?$H$($Pe(B
Exception#initializee$B$rFbIt$GNc30$rH/@8$9$k$b$N$KCV$-49$($?$je(B
e$B$9$l$PF1$8$3$H$,5/$-$^$9!#e(B

e$B$3$N$3$H$+$i9M$($k$H$"$s$^$jD>$9I,MW$O$J$5$=$&$K;W$$$^$9!#$`e(B
e$B$7$m!“e(B(e$B%3%9%H$N$3$H$r9M$($J$1$l$Pe(B)e$BL58B:F5”%A%’%C%/$r87$7$/$9e(B
e$B$kJ}$,M-8z$+$H!#e(B

                            e$B$^$D$b$He(B e$B$f$-$R$me(B /:|)

#3

e$B1sF#$G$9!#e(B

2008/10/31 14:02 Yukihiro M. removed_email_address@domain.invalid:

Exception#initializee$B$rFbIt$GNc30$rH/@8$9$k$b$N$KCV$-49$($?$je(B
e$B$9$l$PF1$8$3$H$,5/$-$^$9!#e(B

e$B$3$N$3$H$+$i9M$($k$H$"$s$^$jD>$9I,MW$O$J$5$=$&$K;W$$$^$9!#$`e(B
e$B$7$m!“e(B(e$B%3%9%H$N$3$H$r9M$($J$1$l$Pe(B)e$BL58B:F5”%A%’%C%/$r87$7$/$9e(B
e$B$kJ}$,M-8z$+$H!#e(B

e$B$3$N7o$K4X$7$F$O!VD>$9I,MW$,$J$$!W$H$$$&H=CG$b$$$$$H;W$$$^$9!#e(B
e$B$G$b$=$l$J$iJ8>O2=$7$?J}$,$$$$$H;W$$$^$9!#e(B

e$B$H$j$"$($:e(B redmine e$B$Ke(B WontFix
e$B$H$$$&%(%s%H%j$r:n$C$F$*$-$^$7$?!#e(B
http://redmine.ruby-lang.org/wiki/ruby-19/WontFix


#4

e$B%A%1%C%He(B #699 e$B$,99?7$5$l$^$7$?!#e(B (by Yukihiro M.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B

e$B$3$l$K$D$$$F$O=$@5$7$J$$$3$H$K$7$^$9e(B

http://redmine.ruby-lang.org/issues/show/699


#5

e$B$h$7$*$+$G$9!#e(B

e$B1sF#$G$9!#e(B

e$B$3$s$K$A$O!"e(B

e$B$J$K$,5/$-$F$k$+$H$$$&$He(B
e$B;k$9$ke(B)e$B$h$&$K$9$l$P!"$3$NLdBj$O$J$/$J$j$^$9$,!"$?$H$($Pe(B
e$B$H$j$"$($:e(B redmine e$B$Ke(B WontFix e$B$H$$$&%(%s%H%j$r:n$C$F$*$-$^$7$?!#e(B
http://redmine.ruby-lang.org/wiki/ruby-19/WontFix

rubye$B$N<BAu$r$^$C$?$/$o$+$C$F$$$J$$Lg304A$J$N$G$9$,!"e(B

— vm_method.c (revision 20086)
+++ vm_method.c (working copy)
@@ -314,7 +314,7 @@
if (OBJ_FROZEN(klass))
rb_error_frozen(“class/module”);
if (mid == object_id || mid == send || mid == idInitialize) {

  •   rb_warn("removing `%s' may cause serious problem", 
    

rb_id2name(mid));

  •   rb_bug("removing `%s' may cause serious problem", 
    

rb_id2name(mid));
}
if (st_lookup(RCLASS_M_TBL(klass), mid, &data)) {
body = (NODE *)data;

e$B$H$7$F!"$3$N;~E@$G$$$5$.$h$/!“e(Baborte$B$5$;$k$H$$$&:n@o$G$$$/$H!”@hF|$Ne(B
e$B%Q%C%A$H$"$o$;$o$6$Ge(B

$ ./ruby -e ‘class Exception; remove_method(:initialize); end; raise’
-e:1: [BUG] removing `initialize’ may cause serious problem
ruby 1.9.0 (2008-11-01 revision 20086) [i686-linux]

– control frame ----------
c:0005 p:---- s:0012 b:0012 l:000011 d:000011 CFUNC :remove_method
c:0004 p:0013 s:0008 b:0008 l:000007 d:000007 CLASS -e:1
c:0003 p:0009 s:0006 b:0006 l:000005 d:000005 TOP -e:1
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH :inherited
c:0001 p:0000 s:0002 b:0002 l:000001 d:000001 TOP :17

DBG> : “-e:1:in remove_method'" DBG> : "-e:1:inclass:Exception’”
DBG> : “-e:1:in `’”
– backtrace of native function call (Use addr2line) –
0x8122c24
0x814e3dc
0x814e44b
0x811cc08
0x811cd62
0x81109dd
0x81128b3
0x811532d
0x8119664
0x811984c
0x805ce9f
0x805e682
0x805bd90
0xb7d7a685
0x805bc91

Aborted
e$B$HMn$A$F$/$l$^$9!#e(B

rb_warn()
e$B$G$I$&$K$+%j%+%P%j$r;n$_$F$$$k$h$&$G$9$,!"$"$-$i$a$A$c$&$H$$$&$N$Oe(B
e$B$@$a$J$s$G$7$g$&$+!)e(B

e$B$@$a$J$s$@$m$&$J$"!#e(B

e$B$he(B

Hiro Y.
Miracle Linux Corporation
http://blog.miraclelinux.com/yume/
http://d.hatena.ne.jp/hyoshiok/


#6

e$B$J$+$@$G$9!#e(B

At Fri, 21 Nov 2008 16:02:12 +0900,
Hiro Y. wrote in [ruby-dev:37134]:

rb_warn() e$B$G$I$&$K$+%j%+%P%j$r;n$_$F$$$k$h$&$G$9$,!"$"$-$i$a$A$c$&$H$$$&$N$Oe(B
e$B$@$a$J$s$G$7$g$&$+!)e(B

e$B$"$-$i$a$A$c$&$3$H$K$OH?BP$7$^$;$s$,!"e(Brb_bug()e$B$O%@%a$G$7$g$&!#e(B
rb_bug()e$B$Oe(Brubye$B<+?H$,=$@5BP>]$H$J$k%P%0$H$$$&$3$H$G$9!#%f!<%6%9%/e(B
e$B%j%W%H$KBP$7$FH/@8$7$F$O$$$1$^$;$s!#e(Brb_raise()e$B$r;H$&$Y$-$G$7$g$&!#e(B