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

limayaml.Save does have some encoding bugs #2665

Open
jandubois opened this issue Sep 28, 2024 · 2 comments
Open

limayaml.Save does have some encoding bugs #2665

jandubois opened this issue Sep 28, 2024 · 2 comments

Comments

@jandubois
Copy link
Member

  1. The function uses a custom marshaller to make sure null and ~ are quoted. It is missing entries for Null and NULL which in the YAML spec also denote the missing value.

  2. I found that tab characters get an extra backslash during the roundtrip (I've filed Custom marshalling does incorrect escaping of some control characters goccy/go-yaml#475) for this. This bug only happens when using a custom marshaller, but not with the default one.

So (1) can be fixed by added the missing cases, but (2) can only be fixed by removing the custom marshaller, making it impossible to fix (1).

But by lucky synchronicity a PR has been filed just 10 hours ago to fix the null issue upstream (goccy/go-yaml#474). I've tested that branch, and it fixes both (1) and (2) when you remove the custom marshaller.

So it is possible to fix the issue right away with a replace directive in go.mod and dropping the custom marshaller:

replace github.com/goccy/go-yaml => github.com/denieryd/go-yaml v0.0.0-20240927195919-fa39d09da8ae

I don't think this is important enough, and we should instead wait a while to see if upstream makes a release. We could fix (1) while we wait, if we want to.

@denieryd
Copy link

Thx for mention ;)

@afbjorklund
Copy link
Member

The main problem was the mount of the home directory, "~", which got marshaled into ~ (null)

So it was the same issue as "null", even if I don't think the strings "null" (or "Null" or "NULL") are used:

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

No branches or pull requests

3 participants