Package: ruby1.8
Version: 1.8.7.72-1
Severity: normal
Tags: patch
User: [EMAIL PROTECTED]
Usertags: origin-ubuntu jaunty ubuntu-patch


In Ubuntu, we've applied the attached patch to achieve the following:

  * debian/patches/905_short_named_constants.dpatch: Fix for short-named
    constants regression (LP: #282302)

This patch should currently be in the stable-snapshot. While this regression
doesn't seem to affect a lot of existing code, it does break the metasploit
framework. Please see the Ubuntu bug [1] for more information.

Jamie

[1] https://bugs.launchpad.net/ubuntu/+source/ruby1.8/+bug/282302
diff -u ruby1.8-1.8.7.72/debian/patches/00list ruby1.8-1.8.7.72/debian/patches/00list
--- ruby1.8-1.8.7.72/debian/patches/00list
+++ ruby1.8-1.8.7.72/debian/patches/00list
@@ -11,0 +12 @@
+905_short_named_constants
only in patch2:
unchanged:
--- ruby1.8-1.8.7.72.orig/debian/patches/905_short_named_constants.dpatch
+++ ruby1.8-1.8.7.72/debian/patches/905_short_named_constants.dpatch
@@ -0,0 +1,48 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 905_short_named_constants.dpatch by Jamie Strandboge <[EMAIL PROTECTED]>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Ubuntu: https://bugs.launchpad.net/ubuntu/+source/ruby1.8/+bug/282302
+## DP: Upstream: http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18485
+## DP: Fix for shot-named constants breakage-- copy cbase in cref as well.
+
[EMAIL PROTECTED]@
+diff -urNad ruby1.8-1.8.7.72~/class.c ruby1.8-1.8.7.72/class.c
+--- ruby1.8-1.8.7.72~/class.c	2008-06-28 05:23:54.000000000 -0500
++++ ruby1.8-1.8.7.72/class.c	2008-10-27 12:18:21.000000000 -0500
+@@ -62,7 +62,10 @@
+     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;
+diff -urNad ruby1.8-1.8.7.72~/eval.c ruby1.8-1.8.7.72/eval.c
+--- ruby1.8-1.8.7.72~/eval.c	2008-08-03 22:24:26.000000000 -0500
++++ ruby1.8-1.8.7.72/eval.c	2008-10-27 12:18:21.000000000 -0500
+@@ -1063,7 +1063,7 @@
+ 
+ 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 {		\
+diff -urNad ruby1.8-1.8.7.72~/node.h ruby1.8-1.8.7.72/node.h
+--- ruby1.8-1.8.7.72~/node.h	2008-07-07 01:17:24.000000000 -0500
++++ ruby1.8-1.8.7.72/node.h	2008-10-27 12:18:21.000000000 -0500
+@@ -319,7 +319,7 @@
+ #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)

Reply via email to