-
Notifications
You must be signed in to change notification settings - Fork 253
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
Fixed issue with output from CMake 3.21.0 #107
Conversation
When calling CMake to obtain triplet information a regression change from CMake 3.20.5 to 3.21.0-rc1 causes the tool to exit due to an exception. This is due to the response containing a mixture of 'n' and '\r\n' line endings. After splitting the output on line feeds ('\n') each line is then trimmed of whitespace to remove any carriage returns ('\r') or trailing whitespace. This could be fixed in CMake but this change makes it robust. This commit in CMake caused the fault: Kitware/CMake@0a0a0f8 It is unlikely to change as they have added a new helper file for writing the terminal output
Fixes these issues reported in Vcpkg. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We call CMake from several different locations; we need to audit each of these for potential \r\n
mishandling.
I have had a look through the places where CMake is called and apart from this instance they either use 'cmd_execute_and_stream_lines', which your pull request #108 handles, or they are written directly to the console. I agree the above is aggressive to remove trailing '\r' characters. (I made the change quickly as I was proving out a large system build using Visual Studio 2022 and I came across this blocking issue). The code could be consistent with other CMake calls in the system by also using 'cmd_execute_and_stream_lines'.
The only 'nasty' bit I don't like is having to join the lines again in case of an error. What is your preference? |
Yeah I like your suggested unification 👍 . The idea of the lines join is fine, though unfortunately the code as written will execute the join on all cases (including non-error). It'd be better to do: if (exit_code != 0)
{
Checks::exit_with_message(VCPKG_LINE_INFO, Strings::join("\n", lines));
} |
Assuming Pull Request microsoft#108 (Add \r\n support to System::cmd_execute_and_stream_lines) has been merged. Calling cmd_execute_and_stream_lines will be the safer and more efficient solution
Fixed by #107, I believe? |
Oh, cool, thanks @MatthewPowley :) |
a release with this PR is very urgent to be deployed in vcpkg because cmake 3.21 is now released and many CI tests using :latest cmake version are now failing :) |
@MatthewPowley thanks for trying the 3.21 release candidates and tracking this down.
I think it is good to tolerate both newline styles in vcpkg.
The newline change was not intentional. I've opened CMake Issue 22444 to discuss this on the CMake side. |
Fixes CMake regression #22444 via microsoft/vcpkg-tool#107.
When calling CMake to obtain triplet information a regression change from CMake 3.20.5 to 3.21.0-rc1
causes the tool to exit due to an exception.
This is due to the response containing a mixture of '\n' and '\r\n' line endings.
After splitting the output on line feeds ('\n') each line is then trimmed of whitespace to remove
any carriage returns ('\r') or trailing whitespace. This could be fixed in CMake but this
change makes it robust.
This commit in CMake caused the fault: Kitware/CMake@0a0a0f8
It is unlikely to change as they have added a new helper file for writing the terminal output.