Bring back the fix for short-named constants.

This previous problems should be gone now.
(ruby svn r18485 and r22679)

Thanks to Jeremy Evans!
This commit is contained in:
bernd 2009-03-07 12:30:17 +00:00
parent f2b32e5234
commit 04529b0584
4 changed files with 79 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.66 2009/02/09 20:48:23 naddy Exp $
# $OpenBSD: Makefile,v 1.67 2009/03/07 12:30:17 bernd Exp $
SHARED_ONLY= Yes
@ -11,7 +11,7 @@ VERSION= 1.8.6
PATCHLEVEL= 287
DISTNAME= ruby-${VERSION}-p${PATCHLEVEL}
SHARED_LIBS= ruby 2.0
PKGNAME-main= ruby-${VERSION}.${PATCHLEVEL}p2
PKGNAME-main= ruby-${VERSION}.${PATCHLEVEL}p3
PKGNAME-iconv= ruby-iconv-${VERSION}.${PATCHLEVEL}p0
PKGNAME-gdbm= ruby-gdbm-${VERSION}.${PATCHLEVEL}p0
PKGNAME-tk= ruby-tk-${VERSION}.${PATCHLEVEL}p0

View File

@ -0,0 +1,31 @@
$OpenBSD: patch-class_c,v 1.3 2009/03/07 12:30:17 bernd Exp $
Fix usage of short-named constants.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18485
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22679
https://bugs.launchpad.net/ubuntu/+source/ruby1.8/+bug/282302
--- class.c.orig Sat Jun 28 12:27:21 2008
+++ class.c Mon Mar 2 13:17:52 2009
@@ -62,7 +62,10 @@ clone_method(mid, body, data)
NODE *fbody = body->nd_body;
if (fbody && nd_type(fbody) == NODE_SCOPE) {
- fbody = rb_copy_node_scope(fbody, ruby_cref);
+ NODE *cref = (NODE*)fbody->nd_rval;
+
+ if (cref) cref = cref->nd_next;
+ fbody = rb_copy_node_scope(fbody, NEW_CREF(data->klass, cref));
}
st_insert(data->tbl, mid, (st_data_t)NEW_METHOD(fbody, body->nd_noex));
return ST_CONTINUE;
@@ -150,7 +153,7 @@ rb_singleton_class_clone(obj)
data.klass = obj;
break;
default:
- data.klass = 0;
+ data.klass = Qnil;
break;
}

View File

@ -0,0 +1,28 @@
$OpenBSD: patch-eval_c,v 1.5 2009/03/07 12:30:17 bernd Exp $
Fix usage of short-named constants.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18485
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22679
https://bugs.launchpad.net/ubuntu/+source/ruby1.8/+bug/282302
--- eval.c.orig Mon Aug 4 05:16:55 2008
+++ eval.c Mon Mar 2 13:18:59 2009
@@ -1066,7 +1066,7 @@ static VALUE ruby_wrapper; /* security wrapper */
NODE *ruby_cref = 0;
NODE *ruby_top_cref;
-#define PUSH_CREF(c) ruby_cref = NEW_NODE(NODE_CREF,(c),0,ruby_cref)
+#define PUSH_CREF(c) ruby_cref = NEW_CREF(c,ruby_cref)
#define POP_CREF() ruby_cref = ruby_cref->nd_next
#define PUSH_SCOPE() do { \
@@ -1399,7 +1399,7 @@ ruby_init()
rb_call_inits();
ruby_class = rb_cObject;
ruby_frame->self = ruby_top_self;
- ruby_top_cref = rb_node_newnode(NODE_CREF,rb_cObject,0,0);
+ ruby_top_cref = NEW_CREF(rb_cObject, 0);
ruby_cref = ruby_top_cref;
rb_define_global_const("TOPLEVEL_BINDING", rb_f_binding(ruby_top_self));
#ifdef __MACOS__

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-node_h,v 1.3 2009/03/07 12:30:17 bernd Exp $
Fix usage of short-named constants.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18485
https://bugs.launchpad.net/ubuntu/+source/ruby1.8/+bug/282302
--- node.h.orig Mon Jul 7 08:01:50 2008
+++ node.h Tue Jan 27 09:46:14 2009
@@ -319,7 +319,7 @@ extern NODE *ruby_top_cref;
#define NEW_MODULE(n,b) NEW_NODE(NODE_MODULE,n,NEW_SCOPE(b),0)
#define NEW_COLON2(c,i) NEW_NODE(NODE_COLON2,c,i,0)
#define NEW_COLON3(i) NEW_NODE(NODE_COLON3,0,i,0)
-#define NEW_CREF(c) (NEW_NODE(NODE_CREF,0,0,c))
+#define NEW_CREF(c,n) NEW_NODE(NODE_CREF,c,0,n)
#define NEW_DOT2(b,e) NEW_NODE(NODE_DOT2,b,e,0)
#define NEW_DOT3(b,e) NEW_NODE(NODE_DOT3,b,e,0)
#define NEW_ATTRSET(a) NEW_NODE(NODE_ATTRSET,a,0,0)