From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#17839: 24.4.50; read-passwd echoes password input in non-interactive sessions Date: Fri, 11 Jul 2014 18:46:16 +0300 Message-ID: <83sim7aofr.fsf@gnu.org> References: <53FA2CB5-2009-4F77-B10D-03B16CE6D715@lunaryorn.com> <87fvi9jn5w.fsf@gmx.de> <87vbr48del.fsf@gmx.de> <834myob55h.fsf@gnu.org> <87mwcg8bdw.fsf@gmx.de> <83y4w09p9c.fsf@gnu.org> <87k37k5an5.fsf@gmx.de> <83tx6o9enr.fsf@gnu.org> <87a98g54ez.fsf@gmx.de> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1405093643 30688 80.91.229.3 (11 Jul 2014 15:47:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Jul 2014 15:47:23 +0000 (UTC) Cc: schwab@suse.de, 17839@debbugs.gnu.org, swiesner@lunaryorn.com To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 11 17:47:15 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1X5d2Y-0004D2-O1 for geb-bug-gnu-emacs@m.gmane.org; Fri, 11 Jul 2014 17:47:14 +0200 Original-Received: from localhost ([::1]:45549 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5d2Y-0007a9-6f for geb-bug-gnu-emacs@m.gmane.org; Fri, 11 Jul 2014 11:47:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5d2Q-0007T0-OE for bug-gnu-emacs@gnu.org; Fri, 11 Jul 2014 11:47:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X5d2M-0005IQ-2s for bug-gnu-emacs@gnu.org; Fri, 11 Jul 2014 11:47:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38840) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5d2M-0005IM-0U for bug-gnu-emacs@gnu.org; Fri, 11 Jul 2014 11:47:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1X5d2L-0003iw-NJ for bug-gnu-emacs@gnu.org; Fri, 11 Jul 2014 11:47:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 11 Jul 2014 15:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17839 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17839-submit@debbugs.gnu.org id=B17839.140509358714249 (code B ref 17839); Fri, 11 Jul 2014 15:47:01 +0000 Original-Received: (at 17839) by debbugs.gnu.org; 11 Jul 2014 15:46:27 +0000 Original-Received: from localhost ([127.0.0.1]:53639 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X5d1j-0003hh-Ld for submit@debbugs.gnu.org; Fri, 11 Jul 2014 11:46:27 -0400 Original-Received: from mtaout24.012.net.il ([80.179.55.180]:36985) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X5d1e-0003hM-6z for 17839@debbugs.gnu.org; Fri, 11 Jul 2014 11:46:21 -0400 Original-Received: from conversion-daemon.mtaout24.012.net.il by mtaout24.012.net.il (HyperSendmail v2007.08) id <0N8K00O000KAC900@mtaout24.012.net.il> for 17839@debbugs.gnu.org; Fri, 11 Jul 2014 18:42:28 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout24.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N8K00IPE0YSA670@mtaout24.012.net.il>; Fri, 11 Jul 2014 18:42:28 +0300 (IDT) In-reply-to: <87a98g54ez.fsf@gmx.de> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:91450 Archived-At: > From: Michael Albinus > Cc: monnier@iro.umontreal.ca, schwab@suse.de, 17839@debbugs.gnu.org, swiesner@lunaryorn.com > Date: Fri, 11 Jul 2014 16:57:40 +0200 > > Eli Zaretskii writes: > > > The result is not 100% satisfactory, as one needs to press RET twice > > to finish the input, and it looks like some garbage is left in the > > input buffer, since the following (normal) input gets something > > strange. A workaround is to press C-z, which produces EOF, instead of > > RET, when password entry is finished. > > Maybe because just "\n" is sent by fprintf()? In the Windows case, > "\r\n" might be the better choice? I don't think so. The problem is not what is printed, the problem is that the loop is not exited on the 1st RET, and in fact it looks like nothing is returned by getchar until you press the 2nd RET. > And maybe we must handle the case, that RET sends 2 characters, which > must be handled by a double call of getchar()? It doesn't look like it sends 2 characters: the next call to getchar after exiting the loop waits for more input. > When I've read the code of read_minibuf_noninteractive for the first > time, I've seen that just CR was used for finishing input You mean, just the newline, right? > and I've thought that nobody ever used this for MS Windows. That code worked perfectly well with cooked input mode, since then RET is converted to a newline by the stdio machinery (as it uses text mode). And that just gave me an idea: switch stdin to binary when not echoing input. Which solved the problem of double RET (and now it's clear why it was being eaten up). Thanks.