Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for yaml swallowing quotes #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix for yaml swallowing quotes #1

wants to merge 1 commit into from

Conversation

esc
Copy link

@esc esc commented Jan 27, 2016

We recent encountered some yaml issues. Imagine a yaml file contains an account
number like 012345678. Since it 'seems' to be a number we might expect it to be
quoted in the final yaml output. However, two things cause this to not happen:

a) The number starts with a leading '0' which is interpreted by Python as
octal.

b) Actually, it can not be octal since it contains the digit '8' and so yaml
says that it must be string and discards the quoting because it is not
ambiguous.

This means that in the final accounts.yaml most accounts are quote except for
those that start with a leading '0' and contain either and '8' or a '9'.

This is an adapted fix inspired by the comments in:

https://bitbucket.org/xi/pyyaml/issues/29/zero-padded-numbers-ending-in-8-or-9-dump

@esc
Copy link
Author

esc commented Jan 27, 2016

cc @schlomo @konz @oliver-schoenherr

Not sure if we actually want this behaviour, but thought I'd push it anyway, just in case.

@schlomo
Copy link

schlomo commented Jan 27, 2016

IMHO this adds totally unnecessary complexity to the code. Nobody else will ever understand (without a deep dive) exactly what the problem was and how the magic fix works.

So my question would be to find out where the actual problem was or if the problem was only imaginary. For an imaginary problem an imaginary fix might suffice :-)

@snordhausen
Copy link
Contributor

What you are reporting is not a bug. The output produced is valid yaml, and should be interpreted by a yaml parser, not by Python.

@konz
Copy link
Contributor

konz commented Jan 28, 2016

I suggest removing YAML format altogether. People do weird stuff, e.g. parsing yaml with bash code, importing to Excel sheets - and this will lead to errors with AWS account ids.

Do we know anyone relying on YAML?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants