Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > yaml bug(?) in pre2

Reply
Thread Tools

yaml bug(?) in pre2

 
 
Martin Pirker
Guest
Posts: n/a
 
      08-09-2004
given: large dataset
dump via .to_yaml
read back from file with YAML::load(f)

runs ok write+read with
V1: ruby 1.8.1 (2004-05-02) [i686-linux-gnu]
V2: ruby 1.8.2 (2004-07-16) [i686-linux] (aka pre1)

broken with
V3: ruby 1.8.2 (2004-07-29) [i686-linux] (aka pre2)


V3 reads dump produced by V1+V2 ok
V1+V2 crash on reading dump from V3


cut down testcase, structure dumped with V3:

------------------------ cut here ------------------------
---
"sfdfdsdsffsdsfdfd":
-
-
whatever:
- something
- >+
cdvfd: fddfdddd

- |

test

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/


- 999999999
------------------------ cut here ------------------------

crash on reading:

irb(main):038:0> File:pen("yamltest","r") do |f| YAML::load(f) end
ArgumentError: parse error on line 14, col 51: Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/'
from /usr/lib/ruby/1.8/yaml.rb:119:in 'load'
from /usr/lib/ruby/1.8/yaml.rb:119:in 'load'
from (irb):38
from (irb):38:in en'
from (irb):38
from :0



the problem appears to be the indentation of "test", if one moves it some
spaces to front it works:

irb(main):037:0> File:pen("yamltest","r") do |f| YAML::load(f) end
=> {"sfdfdsdsffsdsfdfd"=>[[{"whatever"=>["something"]}, "cdvfd: fddfdddd\n\n",
"\ntest\n\n--\nUsing M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/\n"],
999999999]}


yaml dumper from V1+V2 dumps text segment in one line with \..\.. inserts
and proper spaces for indentation


testing with V4: ruby 1.8.2 (2004-08-0 [i686-linux] taken from CVS

dump runs

reading back in only gives size 2:
irb(main):010:0> s = File:pen("mydump","r") do |f| YAML::load(f) end
irb(main):011:0> puts s.size
2

trying to read dump from V1+V2 gives:
ArgumentError: parse error on line 172, col 300:.....

which is a one line string with lotsa \...\... and he seems to choke on
an umlaut u (sorry can't type that on my terminal now)

so, can anybody read the file from V4?
V3 can't, V4 seems do dump the same multiline text like V3, so of course V3 chokes


reverting back to V2:
irb(main):004:0> s = File:pen("mydumpv2","r") do |f| YAML::load(f) end
irb(main):005:0> puts s.size
1077

yep, that's how it should be


Ruby versions from Gentoo, if that matters



so after ~4 hours hunting:
V3 emitter seems to be broken and introduces bug with texts which are dumped as
multiline and don't start at first column
V4 only reads in 2 obj instead of 1000+ and chokes on the upper testcase too


I give up
staying with V2 which is the last worksforme[tm] and will replace the
dump/restore routine with a homegrown, after all it isn't a good idea to
yaml so large datasets - gives pretty 100Mb memory fragmentation...


Martin
 
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
[ANN] Money 3.1.0.pre2 Shane Emmons Ruby 0 08-10-2010 12:24 PM
What is PRE2 and PRE3? n/w novice Cisco 1 06-26-2007 09:38 PM
ANN: PyMedia-1.2.3.0-pre2 is out Dmitry Borisov Python 0 11-04-2004 04:18 AM
YAML Question: Using YAML::YamlNode#transform Method to get float values? RubyQuestions Ruby 0 12-03-2003 02:15 AM
Error Compile 1.8.0 and 1.8.1-pre2 T. Onoma Ruby 1 11-11-2003 11:25 PM



Advertisments