-
Notifications
You must be signed in to change notification settings - Fork 137
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
Ytt removes quotes for hex strings, which makes them ambiguous #822
Comments
This issue is being marked as stale due to a long period of inactivity and will be closed in 5 days if there is no response. |
Hey any updates? Still an issue! |
@Xander-Polishchuk - Thanks for reporting this issue. Yes, we are able to replicate it. This might be because ytt uses the yaml.v2 library to marshal the YAML. However, this specific length hex string is not getting output as expected. Here are some examples that I ran on the ytt playground - if a string has 18 or less number of characters, the quotes are retained. Also, we are exploring go yaml v3 parser to use in ytt for certain scenarios and that would probably resolve this issue because it preserves the original representation of octals, hexadecimals etc. Meanwhile, please let us know if you are blocked on this or if any workaround worked for you. Thanks for reaching out. |
Hey @vmunishwar, thanks for a response. The only workaround is fallback to decimal encoding, but such fallback removes ability to check checksum, therefore not the complete one and opens space for errors. |
So i was checking this issue and this won't be fixed even if we use yaml v3 in ytt. There are open issues for exact problem in yaml project here go-yaml/yaml#435 and go-yaml/yaml#703 |
That's very regretful decision, I wish you could contribute the fix to the yaml library or drop it altogether in favor of predictable results. Main while we considering dropping ytt in our projects in favor of other templating engines due to lack of WYSIWYG before and after templating. |
@Xander-Polishchuk We will discuss this issue in our next community meeting to get input from experts.
|
@Xander-Polishchuk just do
Result should be
This is described in YAML spec |
@oxfn doesn't work, ytt still omit quotes echo 'hex-string: !!str "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"' > template.yaml
ytt -f template.yaml
# hex-string: 0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed ytt version - develop Also generally it won't be a good solution, just a workaround |
@Xander-Polishchuk
In fact maximum value for string is |
@oxfn the issue is with the underlying go/yaml library go-yaml/yaml#435 , when a hex string is bigger than max integer representation in golang (for the int type), the parseInt fails and the number is treated as string and hence not quoted. |
Are you considering go away from go-yaml? As it seems project is dead and doesn't accept any PRs and fixes. |
@Xander-Polishchuk so we had discussed this issue in one of the community meetings and yes, we were considering if moving to https://github.com/kubernetes-sigs/yaml makes more sense now. |
What steps did you take:
What happened:
quotes removed
What did you expect:
quotes preserved, as hex string format might contain specific encoding where string format required (e.g. upper/lower case letters provides checksum)
Environment:
ytt --version
): 0.45.0/etc/os-release
): Fedora 36Vote on this request
This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.
👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"
We are also happy to receive and review Pull Requests if you want to help working on this issue.
The text was updated successfully, but these errors were encountered: