From: matz@... (Yukihiro Matsumoto) Date: 2000-09-26T15:58:39+09:00 Subject: [ruby-talk:5130] Re: crashes in ruby-lex.rb Hi, In message "[ruby-talk:5129] crashes in ruby-lex.rb" on 00/09/26, "Brian F. Feldman" writes: |I've gotten a few crashes when doing some weird things in irb (repeatable in |that they'd occur on line 178). One example I now have which reliably |causes irb to segfault is to enter: This is not caused by irb, but because that Module#dup did not copy its metaclass. --- object.c 2000/09/15 06:00:26 1.28 +++ object.c 2000/09/26 06:57:37 @@ -533,2 +531,11 @@ static VALUE +rb_mod_dup(module) + VALUE module; +{ + VALUE dup = rb_mod_clone(module); + OBJSETUP(dup, RBASIC(module)->klass, BUILTIN_TYPE(module)); + return dup; +} + +static VALUE rb_mod_to_s(klass) @@ -1155,2 +1162,3 @@ rb_define_method(rb_cModule, "clone", rb_mod_clone, 0); + rb_define_method(rb_cModule, "dup", rb_mod_dup, 0); rb_define_method(rb_cModule, "to_s", rb_mod_to_s, 0);