From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: Fix needed for communication with gpg-agent Date: Fri, 23 Feb 2007 18:25:14 -0500 Message-ID: <87abz4cv8l.fsf@stupidchicken.com> References: <87irdzs6pp.fsf@stupidchicken.com> <87r6siy5he.fsf@wheatstone.g10code.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1172273170 18105 80.91.229.12 (23 Feb 2007 23:26:10 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 23 Feb 2007 23:26:10 +0000 (UTC) Cc: wilde@sha-bang.de, Werner Koch , ueno@unixuser.org, storm@cua.dk, emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 24 00:26:03 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HKjnc-0004Jt-Ai for ged-emacs-devel@m.gmane.org; Sat, 24 Feb 2007 00:26:00 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HKjnb-00057L-Ub for ged-emacs-devel@m.gmane.org; Fri, 23 Feb 2007 18:25:59 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HKjn6-0004it-FT for emacs-devel@gnu.org; Fri, 23 Feb 2007 18:25:28 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HKjn5-0004i6-Je for emacs-devel@gnu.org; Fri, 23 Feb 2007 18:25:27 -0500 Original-Received: from south-station-annex.mit.edu ([18.72.1.2]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1HKjn5-0005zf-8L; Fri, 23 Feb 2007 18:25:27 -0500 Original-Received: from grand-central-station.mit.edu (GRAND-CENTRAL-STATION.MIT.EDU [18.7.21.82]) by south-station-annex.mit.edu (8.13.6/8.9.2) with ESMTP id l1NNPO1E006369; Fri, 23 Feb 2007 18:25:24 -0500 (EST) Original-Received: from outgoing-legacy.mit.edu (OUTGOING-LEGACY.MIT.EDU [18.7.22.104]) by grand-central-station.mit.edu (8.13.6/8.9.2) with ESMTP id l1NNPGP9025435; Fri, 23 Feb 2007 18:25:16 -0500 (EST) Original-Received: from localhost (MAIN-TWELVE-TWO-THIRTY-TWO.MIT.EDU [18.19.5.232]) ) by outgoing-legacy.mit.edu (8.13.6/8.12.4) with ESMTP id l1NNPFee024171; Fri, 23 Feb 2007 18:25:15 -0500 (EST) Original-Received: from cyd by localhost with local (Exim 3.36 #1 (Debian)) id 1HKjms-0000hc-00; Fri, 23 Feb 2007 18:25:14 -0500 In-Reply-To: (Richard Stallman's message of "Fri\, 23 Feb 2007 14\:36\:38 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.94 (gnu/linux) X-Scanned-By: MIMEDefang 2.42 X-Spam-Score: -2.599 X-detected-kernel: Solaris 9.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:66714 Archived-At: Richard Stallman writes: > It should not be hard to program Emacs to turn off the signal handler > for tty input while it calls gpg. That way, Emacs won't notice there > is any input, and won't read any. > > This could be a new function made as a variant of call-process. > > Would this solve the problem? I think you're assuming that Emacs calls gpg as a synchronous process: i.e. call gpg, turn off tty input, wait for gpg to finish, restore tty input. The way the PGG code is currently set up, Emacs calls gpg as an asynchronous process, and uses process-send-string to send gpg the input text that we want to encrypt. One reason to avoid call-process is that it communicates with processes using a tempfile, which is a genuine security hole. So for your suggestion to work, we would have to (i) create a new built-in function similar to call-process, (ii) change it to use a pty rather than a tempfile, (iii) make it turn off the Emacs tty signal handler input while the process is running, (iv) find some way to prevent Emacs from re-drawing the terminal screen while the process is running, and (v) re-write pgg-gpg.el to use this built-in function, which will require a revamp of its existing logic. Or, we could recommend using X.