From 9b66fa05485cab306c636ded5fd10b19d1b16f4a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B8=CC=86=20=D0=9F?=
 =?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=BE=D0=B2?= <alexey.pawlow@gmail.com>
Date: Sun, 14 Apr 2019 21:50:55 +0300
Subject: [PATCH 09/N] Do not convert environment for strace

Strace is a Windows program so MSYS2 will convert all arguments and environment vars and that makes debugging msys2 software with strace very tricky.
---
 winsup/cygwin/spawn.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 53ddc60..a04f613 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -572,11 +572,13 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
       bool switch_user = ::cygheap->user.issetuid ()
 			 && (::cygheap->user.saved_uid
 			     != ::cygheap->user.real_uid);
+      bool keep_posix = (iscmd (argv[0], "strace.exe")
+			|| iscmd (argv[0], "strace")) ? true : real_path.iscygexec ();
       moreinfo->envp = build_env (envp, envblock, moreinfo->envc,
 				  real_path.iscygexec (),
 				  switch_user ? ::cygheap->user.primary_token ()
 					      : NULL,
-				  real_path.iscygexec ());
+				  keep_posix);
       if (!moreinfo->envp || !envblock)
 	{
 	  set_errno (E2BIG);
-- 
2.31.1

