-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
A scalar starting with 00 (double zero) is interpreted as octal number #152
Comments
Not only
pyyaml parses
|
you can always set the type explicitly $ cat file.yml
!str 009
$ yq . file.yml
"009" |
I don't think yq will be doing anything to address this issue directly. Under the hood, yq uses PyYAML with developmental YAML 1.2 grammar regular expressions to match numeric literals. We will not be rolling our own regular expressions to address these edge cases, and we will not be backing away from 1.2 support and reverting to plain PyYAML with its 1.1 defaults, because that would cause even worse usability issues (like the "on" -> True problem). The solution for this issue will come from using a fully YAML 1.2 compliant parser. |
Note: if you're encountering this issue with YAML that is emitted by |
hmm, "OK" but...
|
@conao3 yes, I am aware of this issue. The workaround is to use |
@conao3 I committed a fix for the issue where yq emits unquoted string scalars that start with 08 and 09, and released it in v3.4.0. This removes the need to use To be clear, this doesn't address the issue with how these unquoted scalars are parsed in the input, and I don't expect to address this issue within yq. |
OK, thanks! |
When parsing an unquoted value that starts with 00 (zero zero), yq tries to parse it a s octal number.
According to the specification, octals are starting with 0o (zero oscar) and I was expecting the value to parse as string.
file.yaml:
009
Thank you!
The text was updated successfully, but these errors were encountered: