Bug 478672 - Ruby short-named constant bug
Summary: Ruby short-named constant bug
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: ruby
Version: 10
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Jeroen van Meeuwen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-01-03 09:05 UTC by Cong Ma
Modified: 2009-12-18 07:28 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2009-12-18 07:28:10 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Test case for this bug. This file also contain other unrelated tests, though. (2.06 KB, text/plain)
2009-01-03 09:05 UTC, Cong Ma
no flags Details
Patch from the Ubuntu bug report - Rev 18485 from upstream (1.57 KB, patch)
2009-03-30 16:00 UTC, David Hollis
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Launchpad 282302 0 None None None Never

Description Cong Ma 2009-01-03 09:05:01 UTC
Created attachment 328094 [details]
Test case for this bug. This file also contain other unrelated tests, though.

Description of problem:
Ruby interpreter can't handle certain short-named constants in class inheritance. This is illustrated by a Ruby test program attached. The test program is part of Metasploit Framework <http://www.metasploit.com/> by the Metasplot LLC. It does not contain any security-specific code by itself, but merely a sanity check.


Version-Release number of selected component (if applicable):
1.8.6.287-2.fc10


How reproducible:
Always


Steps to Reproduce:
1. Run the Ruby program in the attachment.
2.
3.
  
Actual results:
The test (in function ruby_187_const_bug()) is not passed.


Expected results:
It should have passed.


Additional info:
1. The test program, on failure, produces a banner telling the user to switch to Ruby 1.8.6 because it is believed the bug was introduced in Ruby 1.8.7. However, this of course doesn't apply for Fedora, as we are using 1.8.6. I guess the bug may be introduced when backporting from upstream's release.
2. For more information, please refer to this Ubuntu bug: https://bugs.launchpad.net/ubuntu/+source/ruby1.8/+bug/282302
3. This bug is not present in an earlier version ruby-1.8.6.230-1.fc10.

Comment 1 Fedora Admin XMLRPC Client 2009-01-30 12:45:14 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 2 Jan F. Chadima 2009-03-24 06:54:54 UTC
I plan to port metacploit to fedora a need this functionality. Do you plan to rapair it?

Comment 3 Jeroen van Meeuwen 2009-03-26 09:57:17 UTC
If you feel like it, maybe you can help resolve the issue.

Comment 4 Jan F. Chadima 2009-03-26 10:58:21 UTC
From the header message from the metasploit can be seen that the bug is repaired in the latest snapshot, so I think it is findable in the changelog, and backport the patch is easier than making new one. 


**********************************************************************
***                                                                   *
*** This version of the Ruby interpreter has significant problems, we *
*** strongly recommend that you switch to version 1.8.6 until these   *
*** issues have been corrected. Alternatively, you can download,      *
*** build, and install the latest Ruby snapshot from:                 *
***  - http://www.ruby-lang.org/                                      *
*** For more information, please see the following URL:               *
***  - https://bugs.launchpad.net/bugs/282302                         *
***                                                                   *
***********************************************************************

Comment 5 Jan F. Chadima 2009-03-27 21:34:46 UTC
this is a debuan patch, please verify and if proper apply it
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 905_short_named_constants.dpatch by Jamie Strandboge <jamie>
+##
+## 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.
+
+@DPATCH@
+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)

Comment 6 David Hollis 2009-03-30 16:00:33 UTC
Created attachment 337229 [details]
Patch from the Ubuntu bug report - Rev 18485 from upstream

This patch applies to the current ruby SRPM and allows Metasploit to function properly.

Comment 7 Jeroen van Meeuwen 2009-03-30 22:44:04 UTC
Thanks, I'm rebuilding the package now and will submit to rawhide as soon as I can.

Comment 8 Mamoru TASAKA 2009-10-30 09:51:13 UTC
Note that current F-13/12 ruby does not seem to have this bug.
ruby-1.8.6.383-4.fc11 (which will shortly be included into -testing)
does not have this issue.

Comment 9 Bug Zapper 2009-11-18 10:38:19 UTC
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '10'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 10's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 10 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 10 Bug Zapper 2009-12-18 07:28:10 UTC
Fedora 10 changed to end-of-life (EOL) status on 2009-12-17. Fedora 10 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.