Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iOkh2-0008O0-TB for pgsql-bugs@arkaria.postgresql.org; Sun, 27 Oct 2019 15:43:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iOkh0-000397-GL for pgsql-bugs@arkaria.postgresql.org; Sun, 27 Oct 2019 15:42:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iOkh0-000390-8d for pgsql-bugs@lists.postgresql.org; Sun, 27 Oct 2019 15:42:58 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iOkgt-0005XC-M3 for pgsql-bugs@lists.postgresql.org; Sun, 27 Oct 2019 15:42:57 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x9RFgkE7020360; Sun, 27 Oct 2019 11:42:46 -0400 From: Tom Lane To: =?UTF-8?Q?Juan_Jos=C3=A9_Santamar=C3=ADa_Flecha?= cc: cilizili@protonmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16080: pg_ctl is failed if a fake cmd.exe exist in the current directory. In-reply-to: References: <16080-5d7f03222469f717@postgresql.org> <22130.1572097001@sss.pgh.pa.us> <26128.1572103204@sss.pgh.pa.us> <857.1572111840@sss.pgh.pa.us> Comments: In-reply-to =?UTF-8?Q?Juan_Jos=C3=A9_Santamar=C3=ADa_Flecha?= message dated "Sun, 27 Oct 2019 11:07:31 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <20358.1572190966.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 27 Oct 2019 11:42:46 -0400 Message-ID: <20359.1572190966@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =3D?UTF-8?Q?Juan_Jos=3DC3=3DA9_Santamar=3DC3=3DADa_Flecha?=3D writes: > On Sat, Oct 26, 2019 at 7:44 PM Tom Lane wrote: >> Hm. I don't have any objection to using COMSPEC if it's set, but >> of course that changes nothing from a security perspective. It's >> just a different route by which pg_ctl, pg_upgrade, etc can be >> misled. > Please find attached a patch with this simple modification. I poked around a bit for other references to cmd.exe. It looks like psql's do_shell() is handling this correctly already, but should we not also fix spawn_process() in src/test/regress/pg_regress.c ? There are also a couple of references in pg_upgrade's test.sh, but I don't feel a need to change those. Another point that could be raised here: seeing that psql honors the SHELL variable to substitute for /bin/sh, should these other programs do likewise? I'm inclined to think not, because what psql is doing is launching an interactive shell, so the user's shell preference should be honored. In these other cases we want plain old Bourne shell thank you, so ignoring SHELL seems correct. But it's worth thinking about, and perhaps adding a comment about. regards, tom lane