From: Michal Rokos <m.rokos / sh.cvut.cz> To: matz / ruby-lang.org Subject: Ruby 1.6.6 bug and fix (rb_define_module_under) Hello Matz, Following bug has been introduced in 1.6.6: Situation: Following classes should be permited to define: Object::OpenSSL::Digest::MD5 (OpenSSL module) Object::Digest::MD5 (Ruby's module from EXT) Bug (reported by Brad Hilton <bhilton / vpop.net>): -------------------------- irb(main):001:0> require 'md5' true irb(main):002:0> require 'openssl' NameError: MD5 is already defined from /usr/local/lib/ruby/site_ruby/1.6/openssl.rb:3:in `require' from /usr/local/lib/ruby/site_ruby/1.6/openssl.rb:3 from (irb):2:in `require' from (irb):2 --------------------------- Bug fix: -------------------------- diff -ur ruby-1.6.6/class.c ruby-1.6.6-new/class.c --- ruby-1.6.6/class.c Tue Dec 18 09:40:30 2001 +++ ruby-1.6.6-new/class.c Fri Jan 4 10:29:10 2002 @@ -246,8 +246,8 @@ ID id; id = rb_intern(name); - if (rb_const_defined(outer, id)) { - module = rb_const_get(rb_cObject, id); + if (rb_const_defined_at(outer, id)) { + module = rb_const_get(outer, id); if (TYPE(module) == T_MODULE) return module; rb_raise(rb_eTypeError, "%s::%s is not a module", -------------------------- I hope that patch is correct. Best regards Michal -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Michal Rokos Czech Technical University, Prague E-mail: m.rokos / sh.cvut.cz Jabber: majkl / jabber.cz, ICQ: 36118339 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-