[glib: 4/7] glib/spawn-win32: workaround SEGV on spawnvpe




commit 68aff6dd0713b2663293bce975f0291e2830ed30
Author: Marc-André Lureau <marcandre lureau redhat com>
Date:   Thu Feb 3 19:55:34 2022 +0400

    glib/spawn-win32: workaround SEGV on spawnvpe
    
    I haven't been able to write a reproducer yet and report the bug to
    Microsoft, but this is 100% crashing when running "meson test
    gsubprocess"
    
    Signed-off-by: Marc-André Lureau <marcandre lureau redhat com>

 glib/gspawn-win32.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/glib/gspawn-win32.c b/glib/gspawn-win32.c
index 30812dba6..fc2a96c94 100644
--- a/glib/gspawn-win32.c
+++ b/glib/gspawn-win32.c
@@ -637,6 +637,13 @@ fork_exec (gint                  *exit_status,
 
   argc = protect_argv (argv, &protected_argv);
 
+  /*
+   * FIXME: Workaround broken spawnvpe functions that SEGV when "=X:="
+   * environment variables are missing. Calling chdir() will set the magic
+   * environment variable again.
+   */
+  _chdir (".");
+
   if (stdin_fd == -1 && stdout_fd == -1 && stderr_fd == -1 &&
       (flags & G_SPAWN_CHILD_INHERITS_STDIN) &&
       !(flags & G_SPAWN_STDOUT_TO_DEV_NULL) &&


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]