Re: Possible bug with null document in libyaml

William Spitzak <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <[email protected]>
Note that my original comments are still true. The parser does not care 
if there is a newline at the end and "fails" even if the newline is there:

libyaml if told to write only a scaler of "" will produce a file 
consisting of a single newline. If told to read this it will return 
nothing. Removing the newline (and also adding any number of extra 
newlines) does not make a difference.

Recommended fix is to add logic so that if the very last thing in the 
file is a "" scalar that libyaml somehow modifies the output, such as by 
forcing the --- trailing text.

I absolutly agree with the trailing newline being optional!

Osamu TAKEUCHI wrote:

> I read that Oren modified the spec in YAML 1.2 to accept an input without
> a line break at the end of the stream merely for JSON compatibility. 
> I thought that YAML 1.1 spec refused such an input not accidentally but 
> intentionally.
> 
> http://sourceforge.net/mailarchive/forum.php?thread_name=200e06280904252219i1da33755h200bdac14058ba36%40mail.gmail.com&forum_name=yaml-core
> 
> Anyway, as I wrote, I don't think so, too, except for the reference 
> parser. ;p
> 
> 
>>> According to the spec, this change was done for JSON compatibility.
>>> A YAML 1.2 processor seems to be required to construct a null object 
>>> from an empty node.
>>>
>>> In this point, YAML 1.2 is completely incompatible from YAML 1.1.
>>> Please compare example 7.3 in YAML 1.2 spec with example 8.13 in YAML 
>>> 1.1 spec.
>>>
>> I don't think it's the correct interpretation of the spec.  I'd say that 
>> YAML 1.2 provide a recommended scheme for tag resolution, while YAML 1.1 
>> doesn't, leaving the decision of choosing the default scheme to the 
>> processor authors.  I believe all existing YAML producers interpret an 
>> empty plain scalar as a null value unless instructed otherwise.
> 
> Fmm, I didn't know that.
> 
> I don't understand how we can interprete YAML 1.1 spec as you wrote 
> with provided example 8.13 and 8.15, but if only I misinterpreted 
> the spec, I'm happier to hear that. I was affraid to have the 
> possible incompatibility between YAML 1.1 and 1.2.
> 
> Best,
> Osamu Takeuchi
> 
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Yaml-core mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/yaml-core

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.