Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Bug in the YAML library: #dump fails for certain multi-line strings

Reply
Thread Tools

Bug in the YAML library: #dump fails for certain multi-line strings

 
 
John Trupiano
Guest
Posts: n/a
 
      09-05-2008
Hey guys,

I stumbled across what is a bug in the YAML library. It does not
properly encode certain multi-line strings. Fire up irb, and try the
following:

>> require 'yaml'

=> true
>> s3 = "\n Do I work?\nNo indent"

=> "\n Do I work?\nNo indent"
>> YAML.load(YAML.dump(s3))

ArgumentError: syntax error on line 3, col 0: `No indent'
from /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/1.8/yaml.rb:133:in
`load'
from /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/1.8/yaml.rb:133:in
`load'
from (irb):3

I've confirmed it's broken in both 1.8.6.p111, and REE 1.8.6.p287.

I wrote up a pretty thorough exploration of this bug in a blog post
describing the problem and offering a (sub-optimal) patch:
http://blog.smartlogicsolutions.com/...stringto_yaml/

Is this the right list to discuss this?

-John

 
Reply With Quote
 
 
 
 
John Trupiano
Guest
Posts: n/a
 
      09-05-2008
Just upping this because I think it's particularly important. Is
there a better venue to discuss this? Just curious where the
interested parties (read: the ruby YAML library maintainers) are.....

-John

On Sep 5, 6:17=A0am, John Trupiano <jtrupi...@gmail.com> wrote:
> Hey guys,
>
> I stumbled across what is a bug in the YAML library. =A0It does not
> properly encode certain multi-line strings. =A0Fire up irb, and try the
> following:
>
> >> require 'yaml'

> =3D> true
> >> s3 =3D "\n =A0Do I work?\nNo indent"

>
> =3D> "\n =A0Do I work?\nNo indent">> YAML.load(YAML.dump(s3))
>
> ArgumentError: syntax error on line 3, col 0: `No indent'
> =A0 =A0 =A0 =A0 from /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/1.8/yam=

l.rb:133:in
> `load'
> =A0 =A0 =A0 =A0 from /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/1.8/yam=

l.rb:133:in
> `load'
> =A0 =A0 =A0 =A0 from (irb):3
>
> I've confirmed it's broken in both 1.8.6.p111, and REE 1.8.6.p287.
>
> I wrote up a pretty thorough exploration of this bug in a blog post
> describing the problem and offering a (sub-optimal) patch:http://blog.sma=

rtlogicsolutions.com/2008/09/04/ruby-patch-to-fix-brok...
>
> Is this the right list to discuss this?
>
> -John


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
yaml.rb and YAML "%" directives Joshua Choi Ruby 1 01-14-2007 07:53 AM
Puzzling over why ri can open the std ruby/ri .yaml files, but raw yaml can't Eric Promislow Ruby 4 10-31-2006 10:15 PM
YAML.dump/YAML.load bug Paul Battley Ruby 0 08-03-2005 08:28 PM
YAML bug with : in strings? Guillaume Marcais Ruby 3 10-22-2004 10:34 PM
YAML Question: Using YAML::YamlNode#transform Method to get float values? RubyQuestions Ruby 0 12-03-2003 02:15 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57