Paul Smith wrote:
... else (b) make has to parse this string and break it up into words that it can use to call exec() without going through a shell
The crash and wild call-stack seems to be caused by an overflow to 'sprintf(sh_path, ..)'. But replacing with 'snprintf()' works w/o any crash: --- a/src/main.c 2022-05-10 13:37:02 +++ b/src/main.c 2022-05-11 07:47:07 @@ -956,7 +956,7 @@ { batch_mode_shell = 1; unixy_shell = 0; - sprintf (sh_path, "%s", search_token); + snprintf (sh_path, GET_PATH_MAX, "%s", search_token); default_shell = xstrdup (w32ify (sh_path, 0)); DB (DB_VERBOSE, (_("find_and_set_shell() setting default_shell = %s\n"), default_shell)); @@ -971,7 +971,7 @@ else if (_access (search_token, 0) == 0) { /* search token path was found */ - sprintf (sh_path, "%s", search_token); + snprintf (sh_path, GET_PATH_MAX, "%s", search_token); default_shell = xstrdup (w32ify (sh_path, 0)); DB (DB_VERBOSE, (_("find_and_set_shell() setting default_shell = %s\n"), default_shell)); @@ -994,7 +994,7 @@ { *ep = '\0'; - sprintf (sh_path, "%s/%s", p, search_token); + snprintf (sh_path, GET_PATH_MAX, "%s/%s", p, search_token); if (_access (sh_path, 0) == 0) { default_shell = xstrdup (w32ify (sh_path, 0)); @@ -1016,7 +1016,7 @@ /* be sure to check last element of Path */ if (p && *p) { - sprintf (sh_path, "%s/%s", p, search_token); + snprintf (sh_path, GET_PATH_MAX, "%s/%s", p, search_token); if (_access (sh_path, 0) == 0) { default_shell = xstrdup (w32ify (sh_path, 0)); -------------- And testing it with: set GNUMAKEFLAGS=--debug=verbose,jobs gnumake -f Minimal.make seems to work okay: .. find_and_set_shell() path search set default_shell = f:/CygWin32/bin/sh.exe .. CreateProcess(f:\CygWin32\bin\sh.exe,f:/CygWin32/bin/sh.exe -c "echo \"Hello\"",...) Putting child 012E9F10 (all) PID 20053024 on the chain. Live child 012E9F10 (all) PID 20053024 Main thread handle = 00000118 Hello -- --gv