Re: pg_regress: lookup shellprog in $PATH

From: Noah Misch <noah(at)leadboat(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Gurjeet Singh <gurjeet(at)singh(dot)im>, Postgres Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_regress: lookup shellprog in $PATH
Date: 2022-10-01 19:59:55
Message-ID: 20221001195955.GA94708@gust.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 25, 2022 at 04:04:39PM -0400, Tom Lane wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> > On Thu, Aug 25, 2022 at 10:48 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >> If we were executing a program that the user needs to have some control
> >> over, sure, but what we have here is an implementation detail that I
> >> doubt anyone cares about. The fact that we're using a shell at all is
> >> only because nobody has cared to manually implement I/O redirection logic
> >> in these places; otherwise we'd be execl()'ing the server or psql directly.
> >> Maybe the best answer would be to do that, and get out of the business
> >> of knowing where the shell is?

> The Windows side of this is completely untested and may be broken; also,
> perhaps Windows has something more nearly equivalent to execvp() that we
> could use instead of reconstructing a command line? It's annoying that

Windows has nothing like execvp(), unfortunately.

> the patch removes all shell-quoting hazards on the Unix side but they
> are still there on the Windows side.

It's feasible to take cmd.exe out of the loop. One could then eliminate
cmd.exe quoting (the "^" characters). Can't avoid the rest of the quoting
(https://docs.microsoft.com/en-us/cpp/cpp/main-function-command-line-args#parsing-c-command-line-arguments).
Bypassing cmd.exe would also make it easy to remove the ban on newlines and
carriage returns in arguments.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-10-01 20:38:21 Re: interrupted tap tests leave postgres instances around
Previous Message Tom Lane 2022-10-01 19:50:25 Re: Question: test "aggregates" failed in 32-bit machine