Skip to content

Commit c31530c

Browse files
committed
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.
1 parent 7d376c1 commit c31530c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

winsup/cygwin/spawn.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,11 +546,13 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
546546
bool switch_user = ::cygheap->user.issetuid ()
547547
&& (::cygheap->user.saved_uid
548548
!= ::cygheap->user.real_uid);
549+
bool keep_posix = (iscmd (argv[0], "strace.exe")
550+
|| iscmd (argv[0], "strace")) ? true : real_path.iscygexec ();
549551
moreinfo->envp = build_env (envp, envblock, moreinfo->envc,
550552
real_path.iscygexec (),
551553
switch_user ? ::cygheap->user.primary_token ()
552554
: NULL,
553-
real_path.iscygexec ());
555+
keep_posix);
554556
if (!moreinfo->envp || !envblock)
555557
{
556558
set_errno (E2BIG);

0 commit comments

Comments
 (0)