Replies: 1 comment
-
@Cheney-W Why was the issue closed? It was a proper report, with details, repro and context. I have the fix and am about to submit it.... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
Newline management is complicated because of the differences between different systems like Windows (CRLF) and Linux/Unix (LF). The general wisdom is for editors and tools to either always use the native newline encoding of the OS or to respect the encoding found in the file. However, our observation is that vcpkg.exe on Windows will happily turn the CRLF encoding of all the newlines in the vcpkg.json file from CRLF to LF, even if there's no other change done to the file (if the baseline doesn't change).
Environment
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Expect either the native OS newline encoding (CRLF) or the same encoding found in the file (if preexisting), to be used when writing any text files.
Failure logs
This is a behavioral failure. I don't think logs are relevant, but can provide them given instructions.
Additional context
We were adding the "vcpkg.exe x-update-baseline --add-initial-baseline" command to an automated script in order to keep the baseline up to date, but as soon as it's run the file becomes modified according to git (with "core.autocrlf=true").
vcpkg should strive to be user-friendly in everything it does. I find this anything but. I can see in the tool's source that the original JSON implementer added a newline to the
JsonStyle
structure, but:Lf
.CrLf
invcpkg::Json::<unnamed>::Parser::next()
, but that style is not preserved to be used when writing the file back.Instead the
vcpkg::Json::parse_object()
function abandons it so the stringizer that converts the JSON back to string form uses the default-initializedLf
in itsJsonStyle
structure.The fact that the parser sets this style but doesn't really use it seems to indicate that the original intent was to use it when writing back the file, but this was likely never done.
I may be convinced to implement a fix.
Beta Was this translation helpful? Give feedback.
All reactions