Forum: JRuby Error installing gem: undefined class/module YAML::Syck::DefaultKey

Posted by Aslak Hellesøy (aslakhellesoy)
on 2011-08-17 11:27
(Received via mailing list)
Hi folks,

Using both jruby 1.6.3 and 1.6.1 (on OS X) I get the following error
when I run `gem install gherkin --version 2.4.8` :
https://gist.github.com/1151159
Installing 2.4.6 works fine.

I have downloaded the gems manually, unpacked them and diffed the YAML
gemspecs (metadata file) and I can't see any obvious differences. I am
also able to load both the 2.4.8 and 2.4.6 metadata files with:

   jruby -e "require 'yaml'; p YAML.load_file('2.4.8/metadata')"

and

  jruby -e "require 'yaml'; p YAML.load_file('2.4.6/metadata')"

Does anyone have a clue what's causing this error? Can anyone reproduce 
it?

Aslak
Posted by Rhett Sutphin (Guest)
on 2011-08-17 15:08
(Received via mailing list)
Hi Aslak,

On Aug 17, 2011, at 4:26 AM, aslak hellesoy wrote:

>
>   jruby -e "require 'yaml'; p YAML.load_file('2.4.8/metadata')"
>
> and
>
>  jruby -e "require 'yaml'; p YAML.load_file('2.4.6/metadata')"
>
> Does anyone have a clue what's causing this error? Can anyone reproduce it?

I can reproduce it. Several of my CI builds failed this morning with 
some variation on it. I don't think it's JRuby-specific.

As you noted, on JRuby the error prevents gherkin 2.4.8 from installing. 
On MRI, the error is deferred until the gem is loaded:

$ gem install gherkin -v 2.4.8
Fetching: json-1.5.3.gem (100%)
Building native extensions.  This could take a while...
Fetching: gherkin-2.4.8.gem (100%)
Building native extensions.  This could take a while...
Successfully installed json-1.5.3
Successfully installed gherkin-2.4.8
2 gems installed

$ irb -rrubygems
ruby-1.8.7-p334 :001 > require 'gherkin'
Invalid gemspec in 
[/Users/rsutphin/.rvm/gems/ruby-1.8.7-p334/specifications/gherkin-2.4.8.gemspec]: 
Illformed requirement ["#<YAML::Syck::DefaultKey:0x103fc8f88> 0.7.9"]
LoadError: no such file to load -- gherkin
  from 
/Users/rsutphin/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in 
`gem_original_require'
  from 
/Users/rsutphin/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in 
`require'
  from (irb):1

This suggests to me a packaging problem, but I'm still looking into it.

Rhett
Posted by Jon Forums (jonm)
on 2011-08-17 15:34
(Received via mailing list)
> >
> $ gem install gherkin -v 2.4.8
> Invalid gemspec in 
[/Users/rsutphin/.rvm/gems/ruby-1.8.7-p334/specifications/gherkin-2.4.8.gemspec]: 
Illformed requirement ["#<YAML::Syck::DefaultKey:0x103fc8f88> 0.7.9"]
> LoadError: no such file to load -- gherkin
>   from 
/Users/rsutphin/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in 
`gem_original_require'
>   from 
/Users/rsutphin/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in 
`require'
>   from (irb):1
>

I can't replicate on Win7 32bit with JRuby 1.6.3 in 1.8.7 mode as shown 
below.

@Rhett...I haven't tried on my Arch system, but shouldn't the `gem 
install` be pulling down the *-java.gem versions?


C:\Users\Jon\Documents\RubyDev>jruby --version
jruby 1.6.3 (ruby-1.8.7-p330) (2011-07-07 965162f) (Java HotSpot(TM) 
Client VM 1.7.0) [Windows 7-x86-java]

C:\Users\Jon\Documents\RubyDev>gem install gherkin -v '2.4.8'
Fetching: json-1.5.3-java.gem (100%)
Fetching: gherkin-2.4.8-java.gem (100%)
Successfully installed json-1.5.3-java
Successfully installed gherkin-2.4.8-java
2 gems installed

C:\Users\Jon\Documents\RubyDev\ruby-git>irb -rubygems
irb(main):001:0> require 'gherkin'
=> true
irb(main):002:0> Gherkin.constants.sort
=> ["Formatter", "I18n", "Lexer", "Listener", "Parser", "Rubify"]
irb(main):003:0> Gherkin::Formatter.constants.sort
=> ["Hashable", "Model"]
irb(main):004:0> Gherkin::Formatter::Hashable.new.inspect
=> "#<Gherkin::Formatter::Hashable:0x11ae5c1>"
irb(main):005:0> Gherkin::Formatter::Hashable.new.to_yaml
=> "--- !ruby/object:Gherkin::Formatter::Hashable {}\n\n"
irb(main):006:0> YAML::VERSION
=> "0.60"
irb(main):007:0> YAML::Yecht::VERSION
=> "0.0.2"

Jon

---
blog: http://jonforums.github.com/
twitter: @jonforums

"Anyone who can only think of one way to spell a word obviously lacks 
imagination." - Mark Twain
Posted by Rhett Sutphin (Guest)
on 2011-08-17 15:35
(Received via mailing list)
Hi John,

On Aug 17, 2011, at 8:33 AM, Jon wrote:

>>>
>> $ gem install gherkin -v 2.4.8
>> Invalid gemspec in 
[/Users/rsutphin/.rvm/gems/ruby-1.8.7-p334/specifications/gherkin-2.4.8.gemspec]: 
Illformed requirement ["#<YAML::Syck::DefaultKey:0x103fc8f88> 0.7.9"]
>> LoadError: no such file to load -- gherkin
>>   from 
/Users/rsutphin/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in 
`gem_original_require'
>>   from 
/Users/rsutphin/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in 
`require'
>>   from (irb):1
>>
>
> I can't replicate on Win7 32bit with JRuby 1.6.3 in 1.8.7 mode as shown below.
>
> @Rhett...I haven't tried on my Arch system, but shouldn't the `gem install` be 
pulling down the *-java.gem versions?

I was demonstrating that the problem happens on MRI, too, just delayed. 
That's the output from installing on MRI and then trying to load the 
gem.

Rhett
Posted by Aslak Hellesøy (aslakhellesoy)
on 2011-08-17 15:40
(Received via mailing list)
On Wed, Aug 17, 2011 at 2:35 PM, Rhett Sutphin <rhett.sutphin@gmail.com> 
wrote:
>>>> gemspecs (metadata file) and I can't see any obvious differences. I am
>>> I can reproduce it. Several of my CI builds failed this morning with some 
variation on it. I don't think it's JRuby-specific.
>>> 2 gems installed
>> I can't replicate on Win7 32bit with JRuby 1.6.3 in 1.8.7 mode as shown below.
>>
>> @Rhett...I haven't tried on my Arch system, but shouldn't the `gem install` be 
pulling down the *-java.gem versions?
>
> I was demonstrating that the problem happens on MRI, too, just delayed. That's 
the output from installing on MRI and then trying to load the gem.
>

I believe I have fixed it now (gherkin 2.4.11). The root cause of the
bug seems to be that rubygems writes invalid YAML (or possibly a bug
in YAML itself):

https://github.com/rubygems/rubygems/pull/121
http://groups.google.com/group/cukes/browse_thread...

In short - using gem dependencies with '= X.Y.Z' or 'X.Y.Z' will bite
you in the ass. I had to go back to '>= X.Y.Z'

Thanks for looking into it.

Aslak
Posted by Charles Nutter (headius)
on 2011-08-25 15:53
(Received via mailing list)
On Wed, Aug 17, 2011 at 8:39 AM, aslak hellesoy
<aslak.hellesoy@gmail.com> wrote:
> I believe I have fixed it now (gherkin 2.4.11). The root cause of the
> bug seems to be that rubygems writes invalid YAML (or possibly a bug
> in YAML itself):
>
> https://github.com/rubygems/rubygems/pull/121
> http://groups.google.com/group/cukes/browse_thread...
>
> In short - using gem dependencies with '= X.Y.Z' or 'X.Y.Z' will bite
> you in the ass. I had to go back to '>= X.Y.Z'

So, nothing for us to do but get RubyGems updated in the next version, 
yeah?

- Charlie
Posted by Aslak Hellesøy (aslakhellesoy)
on 2011-08-25 16:09
(Received via mailing list)
On Thu, Aug 25, 2011 at 2:51 PM, Charles Oliver Nutter
<headius@headius.com>wrote:

> > In short - using gem dependencies with '= X.Y.Z' or 'X.Y.Z' will bite
> > you in the ass. I had to go back to '>= X.Y.Z'
>
> So, nothing for us to do but get RubyGems updated in the next version,
> yeah?
>
>
Yes, updating the bundled rubygems version should be enough

Aslak
Posted by Jon Forums (jonm)
on 2011-08-25 16:09
(Received via mailing list)
> > you in the ass. I had to go back to '>= X.Y.Z'
>
> So, nothing for us to do but get RubyGems updated in the next version, yeah?

I ran into the same thing on MRI 1.8.7 and see Eric has made a commit to 
address my issue.  Does his fix work for JRuby as well?

  https://github.com/rubygems/rubygems/pull/121#issu...

Jon

---
blog: http://jonforums.github.com/
twitter: @jonforums

"Anyone who can only think of one way to spell a word obviously lacks 
imagination." - Mark Twain
Posted by Aslak Hellesøy (aslakhellesoy)
on 2011-08-25 16:23
(Received via mailing list)
On Thu, Aug 25, 2011 at 3:09 PM, Jon <jon.forums@gmail.com> wrote:

> > > In short - using gem dependencies with '= X.Y.Z' or 'X.Y.Z' will bite
> > > you in the ass. I had to go back to '>= X.Y.Z'
> >
> > So, nothing for us to do but get RubyGems updated in the next version,
> yeah?
>
> I ran into the same thing on MRI 1.8.7 and see Eric has made a commit to
> address my issue.  Does his fix work for JRuby as well?
>
>
Yes
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.