Skip to content

Commit 99cbf4d

Browse files
mingwandroidGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
strace.cc: Don't set MSYS=noglob
Commit message for this code was: * strace.cc (create_child): Set CYGWIN=noglob when starting new process so that Cygwin will leave already-parsed the command line alonw." I can see no reason for it and it badly breaks the ability to use strace.exe to investigate calling a Cygwin program from a Windows program, for example: strace mingw32-make.exe .. where mingw32-make.exe finds sh.exe and uses it as the shell. The reason it badly breaks this use-case is because dcrt0.cc depends on globbing to happen to parse commandlines from Windows programs; irrespective of whether they contain any glob patterns or not. See quoted () comment: "This must have been run from a Windows shell, so preserve quotes for globify to play with later."
1 parent b867fd9 commit 99cbf4d

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

winsup/utils/strace.cc

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,18 +353,36 @@ create_child (char **argv)
353353
make_command_line (one_line, argv);
354354

355355
SetConsoleCtrlHandler (NULL, 0);
356+
/* Commit message for this code was:
357+
"* strace.cc (create_child): Set CYGWIN=noglob when starting new process so that
358+
359+
Cygwin will leave already-parsed the command line alonw."
360+
361+
I can see no reason for it and it badly breaks the ability to use
362+
strace.exe to investigate calling a Cygwin program from a Windows
363+
program, for example:
364+
strace mingw32-make.exe
365+
.. where mingw32-make.exe finds sh.exe and uses it as the shell.
366+
The reason it badly breaks this use-case is because dcrt0.cc depends
367+
on globbing to happen to parse commandlines from Windows programs;
368+
irrespective of whether they contain any glob patterns or not.
369+
370+
See quoted () comment:
371+
"This must have been run from a Windows shell, so preserve
372+
quotes for globify to play with later."
356373
357374
const char *cygwin_env = getenv ("MSYS");
358375
const char *space;
359376
360-
if (cygwin_env && strlen (cygwin_env) <= 256) /* sanity check */
377+
if (cygwin_env && strlen (cygwin_env) <= 256) // sanity check
361378
space = " ";
362379
else
363380
space = cygwin_env = "";
364381
char *newenv = (char *) malloc (sizeof ("MSYS=noglob")
365382
+ strlen (space) + strlen (cygwin_env));
366383
sprintf (newenv, "MSYS=noglob%s%s", space, cygwin_env);
367384
_putenv (newenv);
385+
*/
368386
ret = CreateProcess (0, one_line.buf, /* command line */
369387
NULL, /* Security */
370388
NULL, /* thread */

0 commit comments

Comments
 (0)