From: Tom Lane <tgl@sss.pgh.pa.us>
To: Matthew Stickney <mtstickney@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: [PATCH] (Windows) psql echoes password when reading from pipe
Date: Tue, 22 May 2018 16:09:06 -0400
Message-ID: <18079.1527019746@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKH_Ld7A=3dFAvUFN1hFq-67=Ronx3Aq-muDhFKh4iHu3MMk6Q@mail.gmail.com>
References: <502a1fff-862b-da52-1031-f68df6ed5a2d@gmail.com>
<14853.1527015354@sss.pgh.pa.us>
<CAKH_Ld7A=3dFAvUFN1hFq-67=Ronx3Aq-muDhFKh4iHu3MMk6Q@mail.gmail.com>
[ please don't top-post ]
Matthew Stickney <mtstickney@gmail.com> writes:
> On Tue, May 22, 2018 at 2:55 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Is it possible to operate on "termin" instead of doing a second open
>> (which might fail, which we are failing to cope with :-()?
> It is possible, at the cost of two extra function calls, which could
> theoretically fail (and require a little extra munging to work on
> Windows CE -- is that a target platform for postgres?).
AFAIK we don't claim to support CE.
> Similar to using CreateFile, I think the cases in which those calls
> could fail are so extraordinary that psql probably wouldn't run at all
> (i.e. there's no console for the process, in which case psql would
> crash as soon as it attempted to do IO). It also requires opening
> termin with "w+", because SetConsoleMode needs write permissions. You
> could avoid that by doing a DuplicateHandle on the underlying handle
> that you retrieve from termin, but I doubt it's worth it.
Hm. The failure mode I was thinking about was insufficient resources
to allocate another handle; so it seems like all of these are more or
less equivalent on that basis, and we might as well go with whatever's
shortest. But perhaps it's worth adding logic to deal with failure
of the call? Or can we expect the additional calls to fall through
silently anyway if given an invalid handle? (If so, maybe a comment
about that is sufficient.)
regards, tom lane
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, mtstickney@gmail.com, pgsql-hackers@lists.postgresql.org
Subject: Re: [PATCH] (Windows) psql echoes password when reading from pipe
In-Reply-To: <18079.1527019746@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