YAML doesn't seem to be working properly

Hi,

I'm trying to marshal some data using Ruby's YAML library, but the files
that YAML.rb is creating aren't loading up properly. I've brought in
the libraries from the most recent 1.8.6 branch, but the problem isn't
solved there.

I've attached a stub script which demonstrates the problem. If someone
who has 1.8.7 can test it and let me know the results, that would be a
huge help. (The script should print some stuff and *not* crash out with
an exception).

Unless, of course, this is a known bug, in which case feel free to just
tell me to upgrade to whatever version is necessary. :slight_smile:

Thanks in advance for your help!

Cheers,

Eric

test.rb (433 Bytes)

I don't have 1.8.7 handy, but 1.8.6 and JRuby 1.1:

$ ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-linux]

$ ruby x.rb
/usr/lib/ruby/site_ruby/1.8:/usr/lib/ruby/site_ruby/1.8/i386-linux:/usr/lib/ruby
/site_ruby:/usr/lib/site_ruby/1.8:/usr/lib/site_ruby/1.8/i386-linux:/usr/lib/sit
e_ruby:/usr/lib/ruby/1.8:/usr/lib/ruby/1.8/i386-linux:.#<Test1:0xb7e558f0
@f1="Test",
@p=nil,
@z=
  [#<Test1:0xb7e557b0
    @f1="Test2",
    @p=#<Test1:0xb7e558f0 ...>,
    @z=[#<Test1:0xb7e55774 @f1="Test3", @p=#<Test1:0xb7e557b0 ...>>]>]>
#<Test1:0xb7e53b40
@f1="Test",
@p=nil,
@z=[#<Test1:0xb7e53780 @f1="Test2", @p=#<Test1:0xb7e53b40 ...>, @z=nil>]>
Test3
x.rb:31: undefined method `' for nil:NilClass (NoMethodError)

$ jruby -v
ruby 1.8.6 (2008-03-28 rev 6360) [i386-jruby1.1]

$ jruby x.rb
/usr2/java/jruby-1.1/lib/ruby/site_ruby/1.8:/usr2/java/jruby-1.1/lib/ruby/site_r
uby:/usr2/java/jruby-1.1/lib/ruby/1.8:/usr2/java/jruby-1.1/lib/ruby/1.8/java:lib
/ruby/1.8:.#<Test1:0xc
@f1="Test",
@p=nil,
@z=
  [#<Test1:0x18
    @f1="Test2",
    @p=#<Test1:0xc ...>,
    @z=[#<Test1:0x24 @f1="Test3", @p=#<Test1:0x18 ...>>]>]>
#<Test1:0x2c
@f1="Test",
@p=nil,
@z=
  [#<Test1:0x38
    @f1="Test2",
    @p=#<Test1:0x2c ...>,
    @z=[#<Test1:0x44 @f1="Test3", @p=#<Test1:0x38 ...>>]>]>
Test3
Test3

···

On Tue, Sep 9, 2008 at 10:17 PM, Eric Gerlach <eric-ruby-talk@gerlach.ca> wrote:

I'm trying to marshal some data using Ruby's YAML library, but the files
that YAML.rb is creating aren't loading up properly. I've brought in
the libraries from the most recent 1.8.6 branch, but the problem isn't
solved there.

I've attached a stub script which demonstrates the problem. If someone
who has 1.8.7 can test it and let me know the results, that would be a
huge help. (The script should print some stuff and *not* crash out with
an exception).

No luck:

16:08:53 JBoss$ /c/Temp/yam2.rb
1.8.7
//padwcl2/home/RKlemme/lib/ruby:/usr/lib/ruby/site_ruby/1.8:/usr/lib/ruby/site_ruby/1.8/i386-cygwin:/usr/lib/ruby/site_ruby:/usr/lib/ruby/vendor_ruby/1.8:/usr/lib/ruby/vendor_ruby/1.8/i386-cygwin:/usr/lib/ruby/vendor_ruby:/usr/lib/ruby/1.8:/usr/lib/ruby/1.8/i386-cygwin:.#<Test1:0x7ff0673c
@f1="Test",
@p=nil,
@z=
  [#<Test1:0x7ff065fc
    @f1="Test2",
    @p=#<Test1:0x7ff0673c ...>,
    @z=[#<Test1:0x7ff065c0 @f1="Test3", @p=#<Test1:0x7ff065fc ...>>]>]>
#<Test1:0x7ff04810
@f1="Test",
@p=nil,
@z=[#<Test1:0x7ff04428 @f1="Test2", @p=#<Test1:0x7ff04810 ...>, @z=nil>]>
Test3
/c/Temp/yam2.rb:32: undefined method `' for nil:NilClass (NoMethodError)

Cheers

robert

···

2008/9/10 Eric Gerlach <eric-ruby-talk@gerlach.ca>:

Hi,

I'm trying to marshal some data using Ruby's YAML library, but the files
that YAML.rb is creating aren't loading up properly. I've brought in
the libraries from the most recent 1.8.6 branch, but the problem isn't
solved there.

I've attached a stub script which demonstrates the problem. If someone
who has 1.8.7 can test it and let me know the results, that would be a
huge help. (The script should print some stuff and *not* crash out with
an exception).

Unless, of course, this is a known bug, in which case feel free to just
tell me to upgrade to whatever version is necessary. :slight_smile:

Thanks in advance for your help!

--
use.inject do |as, often| as.you_can - without end

Eric Gerlach wrote:

Hi,

I'm trying to marshal some data using Ruby's YAML library, but the files
that YAML.rb is creating aren't loading up properly. I've brought in
the libraries from the most recent 1.8.6 branch, but the problem isn't
solved there.

I've attached a stub script which demonstrates the problem. If someone
who has 1.8.7 can test it and let me know the results, that would be a
huge help. (The script should print some stuff and *not* crash out with
an exception).

Unless, of course, this is a known bug, in which case feel free to just
tell me to upgrade to whatever version is necessary. :slight_smile:

For anyone interested, bug filed against Syck here:

http://code.whytheluckystiff.net/syck/ticket/33

I'm not 100% sure that's the culprit, but it seems highly likely. I'm unsubscribing (volume is a little high for my tastes), so please CC any replies to me directly.

Cheers,

Eric