# YAML doesn't seem to be working properly

**URL:** <https://www.ruby-forum.com/t/yaml-doesnt-seem-to-be-working-properly/148180>\
**Category:** Ruby\
**Created:** [September 10, 2008, 4:26am UTC](https://www.ruby-forum.com/t/yaml-doesnt-seem-to-be-working-properly/148180 "2008-09-10T04:26:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [September 10, 2008, 4:26am UTC](https://www.ruby-forum.com/t/yaml-doesnt-seem-to-be-working-properly/148180/1 "2008-09-10T04:26:17Z")

</div>

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. 🙂

Thanks in advance for your help!

Cheers,

Eric

---

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [September 10, 2008, 3:26pm UTC](https://www.ruby-forum.com/t/yaml-doesnt-seem-to-be-working-properly/148180/2 "2008-09-10T15:26:23Z")

</div>

On Tue, Sep 9, 2008 at 10:17 PM, Eric G.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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).

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

---

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [September 10, 2008, 4:15pm UTC](https://www.ruby-forum.com/t/yaml-doesnt-seem-to-be-working-properly/148180/3 "2008-09-10T16:15:50Z")

</div>

2008/9/10 Eric G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> 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. 🙂
> 
> Thanks in advance for your help!

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

---

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [September 11, 2008, 3:29am UTC](https://www.ruby-forum.com/t/yaml-doesnt-seem-to-be-working-properly/148180/4 "2008-09-11T03:29:16Z")

</div>

Eric G. wrote:

> 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. 🙂

For anyone interested, bug filed against Syck here:

[http://code.whytheluckystiff.net/syck/ticket/33](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
