Преглед на файлове

libuv: win/spawn: disable extra-file-descriptor support not needed by CMake

Upstream libuv supports passing file descriptors >= 3 to child processes
via `STARTUPINFOW` members reserved by the MSVC C run-time.  However,
some programs use `GetStartupInfoW` to initialize a `STARTUPINFOW`
structure to pass to `CreateProcessW` without clearing the reserved
members.  If we launch such programs with non-zero values in the
reserved members, the MSVC C run-time in *their* children may not
correctly associate the stdin/stdout/stderr streams' file descriptors
with the corresponding `HANDLE`s.

Patch our copy of libuv to avoid using the reserved members.  This
restores `execute_process` support for the above-described programs as
we had prior to commit 5420639a8d (cmExecuteProcessCommand: Replace
cmsysProcess with cmUVProcessChain, 2023-06-01, v3.28.0-rc1~138^2~8).
It also enables support for such programs when launched by `ctest`.

Fixes: #25996
Fixes: #25889
Brad King преди 1 година
родител
ревизия
a590382850
променени са 1 файла, в които са добавени 7 реда и са изтрити 0 реда
  1. 7 0
      Utilities/cmlibuv/src/win/process.c

+ 7 - 0
Utilities/cmlibuv/src/win/process.c

@@ -1083,8 +1083,15 @@ int uv_spawn(uv_loop_t* loop,
   startup.lpTitle = NULL;
   startup.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
 
+#if 1
+  /* cmake does not need libuv's support for passing file descriptors >= 3
+     to the MSVC C run-time in the child.  Avoid using reserved members.  */
+  startup.cbReserved2 = 0;
+  startup.lpReserved2 = NULL;
+#else
   startup.cbReserved2 = uv__stdio_size(process->child_stdio_buffer);
   startup.lpReserved2 = (BYTE*) process->child_stdio_buffer;
+#endif
 
   startup.hStdInput = uv__stdio_handle(process->child_stdio_buffer, 0);
   startup.hStdOutput = uv__stdio_handle(process->child_stdio_buffer, 1);