Comment 10 for bug 282302

Revision history for this message
HD Moore (hdm-metasploit) wrote :

Was there any special about the 1.8.7 that was shipped with 8.10? One of our users is hitting this error, but our test case to detect the buggy version is not firing, even though it works fine for the 1.8.7 release from the ruby web site:

#
# Check for the ugly 1.8.7 short-named constants bug
#

class ConstBugTestA
        Const = 'A'
        def test
                Const == 'A'
        end
end

ConstBugTestC = ConstBugTestA.dup

class ConstBugTestB < ConstBugTestC
        Const = 'B'
end

def ruby_187_const_bug
        bugged = false

        begin
                ConstBugTestA.new.test()
                ConstBugTestB.new.test()
        rescue ::NameError
                bugged = true
        end

        bugged
end

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