> This is about trust, but +1.

The context, to at least break the requisite trust into smaller lumps:

The yaml standard always permits (and every implementation I'm aware
of accepts) strings in the industry quasi-standard double-quoted, all
funny characters escaped format.

Under certain conditions, it also permits certain strings to be
"bare", letting you produce:

    This is some text.

Instead of

    "This is some text."

However, there are lots of things to watch out for: strings like
"1234" have to be quoted, lest they be parsed as integers; likewise
true, false, etc., strings with trailing white space, unicode
characters, etc.  The list of conditions I patched just determines if
we need to escape the string; the specific line:

 -                    (self =~ /[\x00-\x08\x0B\x0C\x0E-\x1F\x80-\xFF]/) or
 +                    (self =~ /[\x00-\x08\x0A-\x1F\x80-\xFF]/) or

is the test for "funny characters" and the change just adds \x0A
("\n") and \x0D ("\r") to the list, leaving \x09 (tab) the only
control-character we don't escape.  It's shorter because filling in
the gaps turns it into one consecutive range.

As for the why, the problem was occurring with resources with
multi-line string attributes that didn't have a trailing \n (see the
ticket for an example) and these were getting mungled in a way that
subsumed the following line (generally, but not always, another
attribute of the resource), causing a variety of symptoms.   By
escaping the \n and \r we eliminate multi-line string values and thus
dodge the problem.  We produce long lines:

        baseurl: "file:///opt//repo/$basearch/addons/\n
http://puppet/opt//repo/$basearch/addons/\n...

instead of multiple lines:

        baseurl: |-
          file:///opt//repo/$basearch/addons/
                       http://puppet/opt//repo/$basearch/addons/
          :
          :

and eliminate the edge case.

Let me know if this still seems like to much trust is required.

-- Markus

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to