[BUG] non-initialized struct

e$B0J2<$N$h$&$K$9$k$He(B [BUG] e$B$,=P$^$9!#e(B

% ./ruby -ve ’
S = Struct.new(:a)
s = Marshal.dump(S.new(1))
class Object
remove_const :S
end
class S
end
p Marshal.load(s)’
ruby 1.9.0 (2007-09-01 patchlevel 0) [i686-linux]
-e:9: – control frame ----------
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :load
c:0003 p:0078 s:0007 b:0006 l:000005 d:000005 TOP -e:9
c:0002 p:---- s:0003 b:0003 l:000002 d:000002 FINISH :inherited
c:0001 p:---- s:0001 b:-001 l:000000 d:000000 ------

DBG> : “-e:9:in `’”
– backtrace of native function call (Use addr2line) –
0x80f6d1e
0x8113320
0x81133bf
0x80d8358
0x8070ff8
0x8071752
0x8071765
0x805b936
0x8071998
0x80ecdce
0x80f484d
0x80f43dc
0x80f0c23
0x80f4a26
0x80f506b
0x805a32b
0x805a3ae
0x8057605
0xb7e02ea8
0x8057531

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:31709] [BUG] non-initialized struct”
on Sep.02,2007 14:49:01, [email protected] wrote:
| e$B0J2<$N$h$&$K$9$k$He(B [BUG] e$B$,=P$^$9!#e(B
|
| % ./ruby -ve ’
| S = Struct.new(:a)
| s = Marshal.dump(S.new(1))
| class Object
| remove_const :S
| end
| class S
| end
| p Marshal.load(s)’

1.8e$B$G$bF1MM$J$N$G$H$j$"$($:e(B1.8e$B$G8+$F$_$^$7$?$,!"$3$s$J46$8$Ge(B
e$B$7$g$&$+e(B?

e$B%a%C%;!<%8$O$J$s$+Be0F5a$`e(B

Index: marshal.c

— marshal.c (revision 13339)
+++ marshal.c (working copy)
@@ -1198,6 +1198,8 @@ r_object0(arg, proc, ivp, extmod)
ID slot;

   klass = path2class(r_unique(arg));
  •  if (TYPE(klass) != T_STRUCT)
    
  • rb_raise(rb_eArgError, “%s is not a struct”, rb_class2name(klass));
    mem = rb_struct_s_members(klass);
    if (mem == Qnil) {
    rb_raise(rb_eTypeError, “uninitialized struct”);

e$B$=$l$G$O!#e(B

[email protected]$G$9!#e(B

At Mon, 3 Sep 2007 11:07:28 +0900,
U.Nakamura wrote in [ruby-dev:31718]:

| p Marshal.load(s)’

1.8e$B$G$bF1MM$J$N$G$H$j$"$($:e(B1.8e$B$G8+$F$_$^$7$?$,!"$3$s$J46$8$Ge(B
e$B$7$g$&$+e(B?

rb_struct_s_members()e$B$G%A%’%C%/$9$k$3$H$K$7$F!"e(B[BUG]e$B$8$c$J$/$Fe(B
TypeErrore$B$+$J$K$+$K$9$k$H$$$&$N$O$I$&$G$7$g$&$+!#e(B

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:31719] Re: [BUG] non-initialized struct”
on Sep.03,2007 11:35:47, [email protected] wrote:
| > 1.8e$B$G$bF1MM$J$N$G$H$j$"$($:e(B1.8e$B$G8+$F$_$^$7$?$,!"$3$s$J46$8$Ge(B
| > e$B$7$g$&$+e(B?
|
| rb_struct_s_members()e$B$G%A%’%C%/$9$k$3$H$K$7$F!"e(B[BUG]e$B$8$c$J$/$Fe(B
| TypeErrore$B$+$J$K$+$K$9$k$H$$$&$N$O$I$&$G$7$g$&$+!#e(B

ArgumentErrore$B$J$N$Oe(BMarshal.loade$B$NB>$N%Q%?!<%s$G$bF1MM$C$]$$$Ne(B
e$B$G$=$&$7$?$N$G$9$,!"e(Brb_struct_s_members()e$B$NJ}$GNc30$K$9$k$J$ie(B
TypeErrore$B$G$7$g$&$M!#e(B

e$B$7$+$7!"$=$b$=$be(BStructe$B$8$c$J$$J*$KBP$7$Fe(Brb_struct_s_members()
e$B$r8F$V$H$$$&%3!<%I$O$I$&9M$($F$b%P%0$C$F$k$o$1$G!"$=$3$Ge(B[BUG]
e$B$,=P$k$N$be(Bmarshale$BB&$G%A%’%C%/[email protected]$H$$$&[email protected]$J9M$(J}$He(B
e$B$$$&5$$b$7$^$9!#e(B

e$B$=$l$G$O!#e(B

In article removed_email_add[email protected],
“U.Nakamura” [email protected] writes:

e$B$7$+$7!"$=$b$=$be(BStructe$B$8$c$J$$J*$KBP$7$Fe(Brb_struct_s_members()
e$B$r8F$V$H$$$&%3!<%I$O$I$&9M$($F$b%P%0$C$F$k$o$1$G!"$=$3$Ge(B[BUG]
e$B$,=P$k$N$be(Bmarshale$BB&$G%A%’%C%/[email protected]$H$$$&[email protected]$J9M$(J}$He(B
e$B$$$&5$$b$7$^$9!#e(B

e$B;d$Oe(B Struct e$B0J30$Ge(B T_STRUCT e$B$r;H$&$H$$$&OCe(B (Range)
e$B$r9M$($Fe(B
e$B$$$k$N$G!"$I$&9M$($F$b%P%0!"$C$FDx$K$O46$8$J$$$G$9!#e(B

e$B$"$H!"e(B[ruby-dev:31718] e$B$N%Q%C%A$O!"e(BTYPE(klass)
e$B$H$7$F$^$9$,!"e(B
e$B$3$l$O$$$D$be(B T_CLASS e$B$J$s$G$O$J$$$+$H;W$$$^$9!#e(B

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:31721] Re: [BUG] non-initialized struct”
on Sep.03,2007 13:27:46, [email protected] wrote:
| In article [email protected],
| “U.Nakamura” [email protected] writes:
|
| > e$B$7$+$7!"$=$b$=$be(BStructe$B$8$c$J$$J*$KBP$7$Fe(Brb_struct_s_members()
| > e$B$r8F$V$H$$$&%3!<%I$O$I$&9M$($F$b%P%0$C$F$k$o$1$G!"$=$3$Ge(B[BUG]
| > e$B$,=P$k$N$be(Bmarshale$BB&$G%A%’%C%/[email protected]$H$$$&[email protected]$J9M$(J}$He(B
| > e$B$$$&5$$b$7$^$9!#e(B
|
| e$B;d$Oe(B Struct e$B0J30$Ge(B T_STRUCT e$B$r;H$&$H$$$&OCe(B (Range) e$B$r9M$($Fe(B
| e$B$$$k$N$G!"$I$&9M$($F$b%P%0!"$C$FDx$K$O46$8$J$$$G$9!#e(B

e$B$3$N>l9g!"!Ve(BStructe$B$8$c$J$$$b$N!W$O!"$(!<$H!“e(BStructe$B$N7A$r$7$Fe(B
e$B$J$$$b$N!”$H$$$&$3$H$G$*4j$$$7$^$9!#e(B

e$B$J$s$+$&$^$/[email protected]$K=PMh$J$$e(B

| e$B$"$H!"e(B[ruby-dev:31718] e$B$N%Q%C%A$O!"e(BTYPE(klass) e$B$H$7$F$^$9$,!"e(B
| e$B$3$l$O$$$D$be(B T_CLASS e$B$J$s$G$O$J$$$+$H;W$$$^$9!#e(B

e$BG>$,G?$s$G$^$7$?!#e(B
if (rb_class_inherited_p(klass, rb_cStruct) != Qtrue)
e$B$"$?$j$K$J$j$^$9$M!#e(B
e$B$7$+$7$3$l$G$be(BStructe$B$re(Bdupe$B$C$?$b$N$,;H$o$l$k$He(Bloade$B$G$-$J$/$J$ke(B
e$B$+$i%@%a!"$H!#e(B

[email protected]$1$I0U30$HFq$7$$$G$9$M$(!#e(B
e$B$b$A$m$s!"[email protected]$5$s$,[email protected]$C$?$h$&$Ke(Brb_struct_s_members()e$B$Ne(Brb_bug()
e$B$re(Brb_raise()e$B$KJQ$($l$P0l=V$G2r7h$G$9$,e(B…

e$B$=$l$G$O!#e(B

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs