Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WqZFl-0006lS-Oh for pgsql-bugs@arkaria.postgresql.org; Sat, 31 May 2014 02:42:37 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WqZFk-0003vq-Ip for pgsql-bugs@arkaria.postgresql.org; Sat, 31 May 2014 02:42:36 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1WqZFj-0003vj-Eo for pgsql-bugs@postgresql.org; Sat, 31 May 2014 02:42:35 +0000 Received: from mail-yk0-f172.google.com ([209.85.160.172]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1WqZFe-00016m-OD for pgsql-bugs@postgresql.org; Sat, 31 May 2014 02:42:32 +0000 Received: by mail-yk0-f172.google.com with SMTP id 79so2187782ykr.3 for ; Fri, 30 May 2014 19:42:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=HFEIVer0+4YS87/DE8G/iNBO+mkMUidSD22k+z4UftU=; b=D+I6v0K7RZoID/DlZD20iSj5sqHrnFUk2MN/JEV8oi68izjf58tW1d/rfK1/pgKpNU Wo7yPhFZ/Kfn90WwgQ4Zvh4MNg3k2UnzbunPCNOSc1ZfR5YNEOb81mcLRE/j5fpt2W4s DQxY/g/re3sWHRb+k18ruPmmGOdbdOuqL4k7WHsf8bGgj/SoyWmzHujB6BBmPlLwA8vg 8CXItJb1k5LSs43HDJJysZAzsZFzt+kecdzpJNA9MrSGtuaBOOlEaQnMdlr25oh4fNi5 aHm/f1zRLVJpQ5w6yaVcAem4T78IKnu13yi02IseXMhwGuJttrpkhD6mwzFP01zurPuw 2WTQ== X-Gm-Message-State: ALoCoQkeITLzSy9kPB9cK8zoDT2uDEZyyem5yMjAnlbHKlHkELNkDRkf0lABkhDn4hKeu18oNCxs X-Received: by 10.236.116.138 with SMTP id g10mr13687617yhh.110.1401504149462; Fri, 30 May 2014 19:42:29 -0700 (PDT) Received: from tornado.leadboat.com (c-107-4-219-91.hsd1.va.comcast.net. [107.4.219.91]) by mx.google.com with ESMTPSA id j21sm9004159yhj.29.2014.05.30.19.42.28 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 30 May 2014 19:42:28 -0700 (PDT) Date: Fri, 30 May 2014 22:42:27 -0400 From: Noah Misch To: Andres Freund Cc: derek_ealy@rapid7.com, pgsql-bugs@postgresql.org Subject: Re: BUG #10347: Can't write password to psql or pg_dump Message-ID: <20140531024227.GA248952@tornado.leadboat.com> References: <20140516203409.16847.6130@wrigleys.postgresql.org> <20140518102324.GV23662@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140518102324.GV23662@alap3.anarazel.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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