Forums » Ruby-core » Possible YAMl bug in 1.8.4

Possible YAMl bug in 1.8.4
Posted by Damphyr (Guest)
on 08.05.2006 20:30
OK, while parsing the td2 data from the ruby-lang website we stumbled on
a possible bug in YAML in the 1.8.4 version.
I am running 1.8.2-15 of the windows one click installer and the
following code is running perfectly:

require 'yaml'

bug=[{:content=>"\n\n <dl>\n<dt>From: Yukihiro Matsumoto &lt;matz at
ruby-lang.org&gt;</dt>"}]

dumped=YAML.dump(bug)
p YAML::load( dumped )

D:\projects\ruby-lang>ruby yaml_bug.rb
[{:content=>"\n\n <dl>\n<dt>From: Yukihiro Matsumoto &lt;matz at
ruby-lang.org&gt;</dt>"}]

The same code with the 1.8.4-16 RC2 installer produces a syntax error
when loading the dump:

D:\projects\ruby-lang>d:\ruby-1.8.4\bin\ruby.exe yaml_bug.rb
d:/ruby-1.8.4/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line
5, col 4: `    <dt>From: Yukihiro Matsu
moto &lt;matz at ruby-lang.org&gt;</dt>' (ArgumentError)
         from d:/ruby-1.8.4/lib/ruby/1.8/yaml.rb:133:in `load'
         from yaml_bug.rb:6

I traced the problem to a leading space (the one before <dl>). I worked
around it by stripping all leading whitespace from our lines but James
(Edward Gray II) thought we should mention this here.

So is this a bug? It is damn inconvenient anyways :)
Cheers,
V.-
--
http://www.braveworld.net/riva
Re: Possible YAMl bug in 1.8.4
Posted by Curt Hibbs (Guest)
on 09.05.2006 03:54
Its probably a bug.  I'm not familiar with the specifics, but Ruby
1.8.4does have known bugs in its YAML support.

I haven't verified this, by ruby-mswin32 (upon which the one-click 
installer
is built) has a new 1.8.4 build released last month. Since there have 
not
been any further releases of Ruby 1.8.4, I'm assuming that this 
ruby-mswin32
release includes updated YAML fixes from CVS HEAD.

Anyway, I'm going to find out and, if so, update the one-click installer 
for
its next release.

Curt
Re: Possible YAMl bug in 1.8.4
Posted by unknown (Guest)
on 09.05.2006 14:23
Sorry for not quoting, but my webmail spits Base64 :)
Well, can somebody test my snippet with a 1.8.4 installation other than 
the one for Windows?
I don't know if James is on Windows and he was the one who stumbled on 
this behaviour, so it might be that it is still an outstanding YAML bug.
Cheers,
V.-
Re: Possible YAMl bug in 1.8.4
Posted by James Gray (bbazzarrakk)
on 09.05.2006 14:59
On May 9, 2006, at 7:20 AM, damphyr@freemail.gr wrote:

> I don't know if James is on Windows...

I use Mac OS X.

James Edward Gray II
Re: Possible YAMl bug in 1.8.4
Posted by MenTaLguY (Guest)
on 09.05.2006 18:32
On Tue, 9 May 2006 10:51:54 +0900, "Curt Hibbs" <ml.chibbs@gmail.com> 
wrote:
> Its probably a bug.  I'm not familiar with the specifics, but Ruby
> 1.8.4does have known bugs in its YAML support.
> 
> I haven't verified this, by ruby-mswin32 (upon which the one-click
> installer is built) has a new 1.8.4 build released last month. Since there have not
> been any further releases of Ruby 1.8.4, I'm assuming that this
> ruby-mswin32 release includes updated YAML fixes from CVS HEAD.

Hmm.  Assuming that's the case, are fixed snapshots available anywhere 
else, or is this the kind of thing I have to jump in and pull out the 
relevent bits from a cvs diff?

I'm really in an awkward position right now; a lot of stuff I want to do 
requires Ruby 1.8.4, but 1.8.4 is otherwise unusable for me because of 
the YAML bugs.

-mental
Re: Possible YAMl bug in 1.8.4
Posted by Curt Hibbs (Guest)
on 09.05.2006 19:59
Re: Possible YAMl bug in 1.8.4
Posted by MenTaLguY (Guest)
on 09.05.2006 20:24
On Wed, 10 May 2006 02:56:09 +0900, "Curt Hibbs" <ml.chibbs@gmail.com> 
wrote:
> You can download it from here:
> 
>   http://www.garbagecollect.jp/ruby/mswin32/en/download/stable.html

Ah ... no ... see, I need to do Mongrel + YAML-y things using Ruby 1.8.4 
on PPC Linux.  Win32 binaries aren't terribly helpful.  Is there a more 
specific timestamp available for the snapshot it was built from?

(To anyone with experience:) Should I just grab one of the "stable 
snapshots" from ftp.ruby-lang.org to build?  Have people had problems 
with those?  How thoroughly are those tested?

-mental
Re: Possible YAMl bug in 1.8.4
Posted by Mauricio Fernandez (Guest)
on 09.05.2006 20:50
On Tue, May 09, 2006 at 10:51:54AM +0900, Curt Hibbs wrote:
> Its probably a bug.  I'm not familiar with the specifics, but Ruby
> 1.8.4does have known bugs in its YAML support.
> 
> I haven't verified this, by ruby-mswin32 (upon which the one-click installer
> is built) has a new 1.8.4 build released last month. Since there have not
> been any further releases of Ruby 1.8.4, I'm assuming that this ruby-mswin32
> release includes updated YAML fixes from CVS HEAD.
> 
> Anyway, I'm going to find out and, if so, update the one-click installer for
> its next release.

It's not fixed in CVS (ruby_1_8 branch):

$ ruby -v yaml-bug.rb
ruby 1.8.4 (2006-05-09) [i686-linux]
/home/batsman/usr/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on 
line 5, col 4: `    <dt>From: Yukihiro Matsumoto &lt;matz at' 
(ArgumentError)
        from /home/batsman/usr/lib/ruby/1.8/yaml.rb:133:in `load'
        from yaml-bug.rb:7
$ cat yaml-bug.rb
require 'yaml'

bug=[{:content=>"\n\n <dl>\n<dt>From: Yukihiro Matsumoto &lt;matz at
ruby-lang.org&gt;</dt>"}]

dumped=YAML.dump(bug)
p YAML::load( dumped )
Re: Possible YAMl bug in 1.8.4
Posted by Curt Hibbs (Guest)
on 09.05.2006 21:33
On 5/9/06, Mauricio Fernandez <mfp@acm.org> wrote:
> ruby-mswin32
> /home/batsman/usr/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line
> p YAML::load( dumped )
Too bad... The change log does list a few syck bug fixes, but obviously 
not
all of the problems have been fixed.

Curt
Re: Possible YAMl bug in 1.8.4
Posted by why the lucky stiff (Guest)
on 11.05.2006 00:51
Mauricio Fernandez wrote:
> It's not fixed in CVS (ruby_1_8 branch):
>
> $ ruby -v yaml-bug.rb 
> ruby 1.8.4 (2006-05-09) [i686-linux]
> /home/batsman/usr/lib/ruby/1.8/yaml.rb:133:in `load': syntax error ... 
>   
All Ruby HEAD patches have been backported to Syck CVS yesterday.  Also,
outstanding patches from PySyck maintainers and Audrey Tang.  You can
follow here: http://code.whytheluckystiff.net/syck/timeline

I've cleared out many of the tickets also.  Rubyforge tickets are moved.

--
Now, about the bug above.  Thankyou for reporting this!  This appears to
be bad YAML coming out of the emitter.  (Which makes sense since a new
emitter was written for 1.8.3/1.8.4.)  The parser is correctly giving a
syntax error.  I am in the YAML spec looking right now.

At any rate, Syck 0.65 will be updated in Ruby CVS this weekend.

_why