Require 'rubygems' gives llformed requirement [">= 0"] (ArgumentError)

Hello,

When I try to require ‘rubygems’ in IronRuby on mono (OSX) I get the
following error

mono ir.exe -e “require ‘rubygems’”

/Library/Frameworks/Mono.framework/Versions/2.10.1/lib/ironruby/bin/…/Lib/ruby/1.9.1/rubygems/requirement.rb:72:in
parse': Illformed requirement [">= 0"] (ArgumentError) from /Library/Frameworks/Mono.framework/Versions/2.10.1/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/requirement.rb:97:in map!’
from
/Library/Frameworks/Mono.framework/Versions/2.10.1/lib/ironruby/bin/…/Lib/ruby/1.9.1/rubygems/requirement.rb:97:in
initialize' from mscorlib:0:in invoke_object__this___Func4<object, Proc, object, object>_object_Proc_object' from /Library/Frameworks/Mono.framework/Versions/2.10.1/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/requirement.rb:97:in initialize’
from
/Library/Frameworks/Mono.framework/Versions/2.10.1/lib/ironruby/bin/…/Lib/ruby/1.9.1/rubygems/requirement.rb:53:in
default' from /Library/Frameworks/Mono.framework/Versions/2.10.1/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/specification.rb:1201:in require’
from
/Library/Frameworks/Mono.framework/Versions/2.10.1/lib/ironruby/bin/…/Lib/ruby/1.9.1/rubygems/specification.rb:1201
from
/Library/Frameworks/Mono.framework/Versions/2.10.1/lib/ironruby/bin/…/Lib/ruby/1.9.1/rubygems/custom_require.rb:29:in
require' from /Library/Frameworks/Mono.framework/Versions/2.10.1/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/source_index.rb:8:in require’
from
/Library/Frameworks/Mono.framework/Versions/2.10.1/lib/ironruby/bin/…/Lib/ruby/1.9.1/rubygems/source_index.rb:8
from
/Library/Frameworks/Mono.framework/Versions/2.10.1/lib/ironruby/bin/…/Lib/ruby/1.9.1/rubygems/custom_require.rb:29:in
require' from /Library/Frameworks/Mono.framework/Versions/2.10.1/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems.rb:1088:in require’
from
/Library/Frameworks/Mono.framework/Versions/2.10.1/lib/ironruby/bin/…/Lib/ruby/1.9.1/rubygems.rb:1088
from
/Library/Frameworks/Mono.framework/Versions/2.10.1/lib/ironruby/bin/…/Lib/ruby/1.9.1/rubygems/custom_require.rb:29:in
`require’

I’ve tried this with the IronRuby that ships with mono 2.10 binaries for
OSX and I’ve also built IronRuby v1.1.2 and v1.1.3 from source. I get
the same error in all three versions. Has anyone else experience this
and knows what the issue might be?

//M


phone: +46 (0)709 78 40 03
e-mail: [email protected]
twitter: http://twitter.com/m_mazur

This appears to be a result of the following mono bug:
https://bugzilla.novell.com/show_bug.cgi?id=541823

The specific issue is that the regex:
(?-six:\A[\s](=|!=|>|<|>=|<=|~>)?[\s]([0-9]+(.[0-9a-zA-Z]+))[\s]\z)
Does not match “>= 0” in mono but does match on .NET

This is a mono bug, not an ironruby bug.

On Sun, Jun 5, 2011 at 12:45 PM, Martin M. [email protected] wrote:

from
/Library/Frameworks/Mono.framework/Versions/2.10.1/lib/ironruby/bin/…/Lib/ruby/1.9.1/rubygems/requirement.rb:97:in
`initialize’

Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core


Michael L.
----------//-----------
http://blog.prokrams.com

FWIW, the issue only appears to manifest itself when later sequences
in a ‘|’ group are substrings of earlier squences. So, for instance
if you move |>|< to the end of the group it appears to work:
(?-six:\A[\s](=|!=|>=|<=|~>|>|<)?[\s]([0-9]+(.[0-9a-zA-Z]+))[\s]\z)

Editing the rubygems/requirement.rb file as follows allows rubygems to
load:

diff --git a/Languages/Ruby/StdLib/ruby/1.9.1/rubygems/requirement.rb
b/Languages/Ruby/StdLib/ruby/1.9.1/rubygems/requirement.
index d51bf8f…b47859e 100644
— a/Languages/Ruby/StdLib/ruby/1.9.1/rubygems/requirement.rb
+++ b/Languages/Ruby/StdLib/ruby/1.9.1/rubygems/requirement.rb
@@ -10,10 +10,10 @@ class Gem::Requirement
OPS = { #:nodoc:
“=” => lambda { |v, r| v == r },
“!=” => lambda { |v, r| v != r },

  • “>” => lambda { |v, r| v > r },
  • “<” => lambda { |v, r| v < r },
    “>=” => lambda { |v, r| v >= r },
    “<=” => lambda { |v, r| v <= r },
  • “>” => lambda { |v, r| v > r },
  • “<” => lambda { |v, r| v < r },
    “~>” => lambda { |v, r| v = v.release; v >= r && v < r.bump }
    }

No promises on the issue not creeping up down the road though…

On Fri, Jun 10, 2011 at 11:48 PM, Michael L.
[email protected] wrote:

Hello,
from
/Library/Frameworks/Mono.framework/Versions/2.10.1/lib/ironruby/bin/…/Lib/ruby/1.9.1/rubygems/requirement.rb:53:in
`default’
I’ve tried this with the IronRuby that ships with mono 2.10 binaries for OSX
and I’ve also built IronRuby v1.1.2 and v1.1.3 from source. I get the same error
in all three versions. Has anyone else experience this and knows what the issue
might be?
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core


Michael L.
----------//-----------
http://blog.prokrams.com


Michael L.
----------//-----------
http://blog.prokrams.com

This appears to be a result of the following mono bug:
Access Denied

Thank you! This helps me a lot.

//M