pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>
Cc: cilizili@protonmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16080: pg_ctl is failed if a fake cmd.exe exist in the current directory.
Date: Sun, 27 Oct 2019 11:42:46 -0400
Message-ID: <20359.1572190966@sss.pgh.pa.us> (raw)
In-Reply-To: <CAC+AXB1UKiioDZE5WwofFUL7smA2cqf71U2K5mfRNrjTrggiww@mail.gmail.com>
References: <16080-5d7f03222469f717@postgresql.org>
	<22130.1572097001@sss.pgh.pa.us>
	<CAC+AXB3Rj1KkQtLMGqpO5q9_+50Rzre_u4KZjXerX+kHfWsJ2A@mail.gmail.com>
	<26128.1572103204@sss.pgh.pa.us>
	<CAC+AXB2GhuACSEdueBnCojvTeg=4Y0enyvnBiX7LTjFXNrKK0w@mail.gmail.com>
	<857.1572111840@sss.pgh.pa.us>
	<CAC+AXB1UKiioDZE5WwofFUL7smA2cqf71U2K5mfRNrjTrggiww@mail.gmail.com>

=?UTF-8?Q?Juan_Jos=C3=A9_Santamar=C3=ADa_Flecha?= <juanjo.santamaria@gmail.com> writes:
> On Sat, Oct 26, 2019 at 7:44 PM Tom Lane <tgl@sss.pgh.pa.us> 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





view thread (10+ messages)  latest in thread

Message-ID: <20359.1572190966@sss.pgh.pa.us>
Permalink:  ../20359.1572190966@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20359.1572190966@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, juanjo.santamaria@gmail.com, cilizili@protonmail.com
  Subject: Re: BUG #16080: pg_ctl is failed if a fake cmd.exe exist in the current directory.
  In-Reply-To: <20359.1572190966@sss.pgh.pa.us>
  References: <16080-5d7f03222469f717@postgresql.org> <22130.1572097001@sss.pgh.pa.us> <CAC+AXB3Rj1KkQtLMGqpO5q9_+50Rzre_u4KZjXerX+kHfWsJ2A@mail.gmail.com> <26128.1572103204@sss.pgh.pa.us> <CAC+AXB2GhuACSEdueBnCojvTeg=4Y0enyvnBiX7LTjFXNrKK0w@mail.gmail.com> <857.1572111840@sss.pgh.pa.us> <CAC+AXB1UKiioDZE5WwofFUL7smA2cqf71U2K5mfRNrjTrggiww@mail.gmail.com> <20359.1572190966@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox