Re-enable autoruns for cmd.exe on Windows
authorMichael Paquier <[email protected]>
Mon, 8 Jul 2024 00:43:59 +0000 (09:43 +0900)
committerMichael Paquier <[email protected]>
Mon, 8 Jul 2024 00:43:59 +0000 (09:43 +0900)
This acts as a revert of b83747a8a65b and 9886744a361b.  As pointed out
by Noah, HEAD and REL_17_STABLE are in a weird state where the code
paths adding /D would limit the spawn of child processes, but we still
have code paths where the spawn of more than one child process(es) would
be possible.

Let's remove these /D switches for now, to bring back the code into a
state consistent with how autorun is configured on a Windows host.

Reported-by: Noah Misch
Discussion: https://postgr.es/m/20240630021211[email protected]
Backpatch-through: 17

src/bin/pg_ctl/pg_ctl.c
src/test/regress/pg_regress.c

index 405e223c19094f70c1a4a5dd06d2d1fd2cc3540c..57ed8c8e294f56a4de7b96eedcd47e03b0e6a62b 100644 (file)
@@ -552,11 +552,11 @@ start_postmaster(void)
        else
            close(fd);
 
-       cmd = psprintf("\"%s\" /D /C \"\"%s\" %s%s < \"%s\" >> \"%s\" 2>&1\"",
+       cmd = psprintf("\"%s\" /C \"\"%s\" %s%s < \"%s\" >> \"%s\" 2>&1\"",
                       comspec, exec_path, pgdata_opt, post_opts, DEVNULL, log_file);
    }
    else
-       cmd = psprintf("\"%s\" /D /C \"\"%s\" %s%s < \"%s\" 2>&1\"",
+       cmd = psprintf("\"%s\" /C \"\"%s\" %s%s < \"%s\" 2>&1\"",
                       comspec, exec_path, pgdata_opt, post_opts, DEVNULL);
 
    if (!CreateRestrictedProcess(cmd, &pi, false))
index 06f6775fc65b082bfd252b3472c8380528add9ab..7e7ad256000164866d324a0dbaed652ace84577f 100644 (file)
@@ -1244,7 +1244,7 @@ spawn_process(const char *cmdline)
        comspec = "CMD";
 
    memset(&pi, 0, sizeof(pi));
-   cmdline2 = psprintf("\"%s\" /d /c \"%s\"", comspec, cmdline);
+   cmdline2 = psprintf("\"%s\" /c \"%s\"", comspec, cmdline);
 
    if (!CreateRestrictedProcess(cmdline2, &pi))
        exit(2);