Skip to content
2 changes: 1 addition & 1 deletion winsup/utils/mingw/cygcheck.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ static const char *known_env_vars[] = {
"c_include_path",
"compiler_path",
"cxx_include_path",
"msys",
"dejagnu",
"expect",
"gcc_default_options",
Expand All @@ -107,6 +106,7 @@ static const char *known_env_vars[] = {
"lpath",
"make_mode",
"makeflags",
"msys",
"path",
"pwd",
"strace",
Expand Down
31 changes: 8 additions & 23 deletions winsup/utils/mingw/strace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -356,36 +356,21 @@ create_child (char **argv)
printf ("create_child: %s\n", one_line.buf);

SetConsoleCtrlHandler (NULL, 0);
/* 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."

const char *cygwin_env = getenv ("MSYS");

#if 0
const char *cygwin_env = getenv ("CYGWIN");
const char *space;

if (cygwin_env && strlen (cygwin_env) <= 256) // sanity check
if (cygwin_env && strlen (cygwin_env) <= 256) /* sanity check */
space = " ";
else
space = cygwin_env = "";
char *newenv = (char *) malloc (sizeof ("MSYS=noglob")
char *newenv = (char *) malloc (sizeof ("CYGWIN=noglob")
+ strlen (space) + strlen (cygwin_env));
sprintf (newenv, "MSYS=noglob%s%s", space, cygwin_env);
sprintf (newenv, "CYGWIN=noglob%s%s", space, cygwin_env);
_putenv (newenv);
*/
#endif

ret = CreateProcess (0, one_line.buf, /* command line */
NULL, /* Security */
NULL, /* thread */
Expand Down
Loading