pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: Andres Freund <andres@2ndquadrant.com>
Cc: derek_ealy@rapid7.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #10347: Can't write password to psql or pg_dump
Date: Fri, 30 May 2014 22:42:27 -0400
Message-ID: <20140531024227.GA248952@tornado.leadboat.com> (raw)
In-Reply-To: <20140518102324.GV23662@alap3.anarazel.de>
References: <20140516203409.16847.6130@wrigleys.postgresql.org>
	<20140518102324.GV23662@alap3.anarazel.de>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On Sun, May 18, 2014 at 12:23:24PM +0200, Andres Freund wrote:
> On 2014-05-16 20:34:09 +0000, derek_ealy@rapid7.com wrote:
> > On Windows systems the psql or pg_dump process always hangs after sending
> > the password to stdin of the process.
> > 
> > I've gotten around this problem by setting an environment variable before
> > exec'ing the process. I set OSTYPES=msys. This forces psql to use stdin when
> > reading the password.
> 
> I think the important point - and why I asked for a bugreport after
> talking about it on irc - is that sprompt.c on windows uses
> CONIN$/CONOUT$ for io. Ignoring stdin/stdout except when the OSTYPE is
> set to msys. Given that CONIN$/OUT seem to refer to the shell that
> started a processtree from a shell that doesn't seem to be optimal.

That code is trying to mimic the non-Windows behavior, which is to interact
with /dev/tty when available.  Unfortunately, CONIN$/CONOUT$ are ~always
nominally available, but they may not route to anything visible to the user.
The OSTYPE test is a crude attempt to anticipate that problem.
IsWindowVisible(GetConsoleWindow()) looked more reliable, but it still didn't
cover everything:
http://www.postgresql.org/message-id/flat/20121010110555.GA21405@tornado.leadboat.com

-- 
Noah Misch
EnterpriseDB                                 http://www.enterprisedb.com


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (5+ messages)

Message-ID: <20140531024227.GA248952@tornado.leadboat.com>
Permalink:  ../20140531024227.GA248952@tornado.leadboat.com/
Also on:    postgresql.org/message-id/20140531024227.GA248952@tornado.leadboat.com

 · 

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: noah@leadboat.com, andres@2ndquadrant.com, derek_ealy@rapid7.com
  Subject: Re: BUG #10347: Can't write password to psql or pg_dump
  In-Reply-To: <20140531024227.GA248952@tornado.leadboat.com>
  References: <20140516203409.16847.6130@wrigleys.postgresql.org> <20140518102324.GV23662@alap3.anarazel.de> <20140531024227.GA248952@tornado.leadboat.com>

* 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