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


#1

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 :


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


#2

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:inrequire’
from (irb):1

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

Rhett


#3

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


#4

On Wed, Aug 17, 2011 at 2:35 PM, Rhett S. removed_email_address@domain.invalid
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/thread/7e926a3b59545651

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


#5

On Wed, Aug 17, 2011 at 8:39 AM, aslak hellesoy
removed_email_address@domain.invalid 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/thread/7e926a3b59545651

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

#6

On Thu, Aug 25, 2011 at 2:51 PM, Charles Oliver N.
removed_email_address@domain.invalidwrote:

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


#7

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#issuecomment-1895766

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


#8

On Thu, Aug 25, 2011 at 3:09 PM, Jon removed_email_address@domain.invalid 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


#9

$ 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:inrequire’
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™
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