MSYS2-packages/msys2-runtime-3.3/0009-Do-not-convert-environment-for-strace.patch
Christoph Reiter 743bae3086 Add msys2-runtime-3.3
Provides and conflicts with msys2-runtime, so can be used to replace it if wanted.

Keep this as a separate package to test for regressions in cygwin
and to have (in theory) a runtime that supports 32bit in the repo.

There is no guarantee for how long we are going to keep this.
2022-12-09 17:58:25 +01:00

31 lines
1.3 KiB
Diff

From 528620587ae370a0019218428b5af74a79186841 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 283041a..49cd941 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -570,11 +570,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);