Skip to content

Work around an UCRT issue with _wspawn() functions taking an envp block

Luca Bacci requested to merge lb90/glib:work-around-ucrt-spawn-env-issue into main

Commit 68aff6dd added a workaround for an issue in the UCRT with the _wspawn*e functions by calling _chdir. This is useful, but works only if the current directory is on a mounted volume with a letter. For example, if the current directory is on a network share with a UNC path (e.g \\servername\path\to\directory), then the call to chdir won't help.

TBD:

  • Add a test
  • How can we flush g_warning?

References:

  1. https://developercommunity.visualstudio.com/t/UCRT-Crash-in-_wspawne-functions/10262748
  2. https://github.com/huangqinjin/ucrt/blob/f941b37/misc/chdir.cpp#L70
  3. https://github.com/huangqinjin/ucrt/blob/f941b37/misc/chdir.cpp#L39
Edited by Luca Bacci

Merge request reports