[cmake-developers] [PATCH v7] For Windows encode process output to internally used encoding

Dāvis Mosāns davispuh at gmail.com
Sun Oct 30 21:06:46 EDT 2016


2016-08-17 16:47 GMT+03:00 Brad King <brad.king at kitware.com>:
> I squashed in one warning fix:
>
>  Windows: Encode child process output to internally-used encoding
>  https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=12924660
>
> However, then I had to revert the change from `next` because it
> causes the CTest.UpdateGIT test to fail on Windows machines.
> I think the problem is that we run Git with a `-z` option to
> produce binary output.  In such cases we should not do any
> encoding conversions.  cmProcessTools and RunSingleCommand
> will need to gain options for this.

While git's `-z` flag caused test to fail it wasn't because of binary
output (we're still working with text data like commit messages and
file names) but it showed a bug that we would truncate output till
first null byte. `-z` option specifies that git will use null bytes as
separators between entries and it's independent from used text
encoding. We still need to decode git's output (which contains null
bytes) to our internal encoding.

> Also I noticed that if DecodeText buffers partial characters we
> may need a finalize step later to finish them off.  Otherwise
> invalid byte sequences may be dropped if they appear at the end.
>
> Please fetch the above version and revise it as needed.
>

I've fixed it and submitted MR to
https://gitlab.kitware.com/cmake/cmake/merge_requests/221


More information about the cmake-developers mailing list