Problem with yaml and lines beginning with a colon

Hi all,

For some reason, yaml reads strings beginning with a colon as symbols
which leads to ‘cannot dup symbol’ exceptions.

$ ruby -v
ruby 1.8.1 (2004-04-24) [i686-linux-gnu]

$ irb
irb(main):001:0> require ‘yaml’
=> true
irb(main):002:0> YAML::load(" :0 local".to_yaml)
=> " :0 local"
irb(main):003:0> YAML::load(":0 local".to_yaml)
=> :“0 local”

Note the first string has a leading space and the second has not. The
latter is not read back correctly.

Is this is a bug?
Does anyone know a workaround?

Thanks.

Hi,

Please ignore this reply. I’m just testing whether I can post a reply and
then view it using Outlook Express.

Regards,
Richard

“Xavier” NOSPAM@keepyourspam.com wrote in message
news:pan.2004.05.11.22.52.24.17880@keepyourspam.com

···

Hi all,

For some reason, yaml reads strings beginning with a colon as symbols
which leads to ‘cannot dup symbol’ exceptions.

$ ruby -v
ruby 1.8.1 (2004-04-24) [i686-linux-gnu]

$ irb
irb(main):001:0> require ‘yaml’
=> true
irb(main):002:0> YAML::load(" :0 local".to_yaml)
=> " :0 local"
irb(main):003:0> YAML::load(":0 local".to_yaml)
=> :“0 local”

Note the first string has a leading space and the second has not. The
latter is not read back correctly.

Is this is a bug?
Does anyone know a workaround?

Thanks.


Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.678 / Virus Database: 440 - Release Date: 5/9/2004

Xavier wrote:

irb(main):003:0> YAML::load(":0 local".to_yaml)
=> :“0 local”

Is this is a bug?
Does anyone know a workaround?

This is a bug in Ruby CVS. Has been since Apr 3. For now, you can
checkout a copy of 1.8 previous to that (including the 1.8.1 release).
I’ll report back when I have a fix.

_why

Xavier wrote:

Hi all,

For some reason, yaml reads strings beginning with a colon as symbols
which leads to ‘cannot dup symbol’ exceptions.

irb(main):003:0> YAML::load(":0 local".to_yaml)
=> :“0 local”

Just wanted to followup and say that this is fixed in CVS. Symbol
loading is much improved now. Thankyou.

_why

You remark helped me locate where strings with a leading colon
become a symbol. I’ll just remove that bit until the problem is fixed. I
know I will not use symbols.

Thanks for your support.

···

On Wed, 12 May 2004 10:25:14 +0900, why the lucky stiff wrote:

Xavier wrote:

irb(main):003:0> YAML::load(":0 local".to_yaml)
=> :“0 local”

Is this is a bug?
Does anyone know a workaround?

This is a bug in Ruby CVS. Has been since Apr 3. For now, you can
checkout a copy of 1.8 previous to that (including the 1.8.1 release).
I’ll report back when I have a fix.

_why

Good news.
Thanks for the info.

···

On Mon, 17 May 2004 00:51:59 +0900, why the lucky stiff wrote:

Xavier wrote:

Hi all,

For some reason, yaml reads strings beginning with a colon as symbols
which leads to ‘cannot dup symbol’ exceptions.

irb(main):003:0> YAML::load(":0 local".to_yaml)
=> :“0 local”

Just wanted to followup and say that this is fixed in CVS. Symbol
loading is much improved now. Thankyou.

_why