From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: don@donarmstrong.com (Emacs bug Tracking System) Newsgroups: gmane.emacs.bugs Subject: bug#472: marked as done (pgg-gpg.el - pgg-gpg-process-region timing problem) Date: Sat, 2 Aug 2008 12:15:08 -0700 Message-ID: References: <873aln2q1d.fsf@stupidchicken.com> <2cd46e7f0806231044w6410b825s9611ba713e9ac353@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----------=_1217704508-31730-8" X-Trace: ger.gmane.org 1217705323 2008 80.91.229.12 (2 Aug 2008 19:28:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 2 Aug 2008 19:28:43 +0000 (UTC) To: Chong Yidong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 02 21:29:33 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KPMnD-00045b-Ao for geb-bug-gnu-emacs@m.gmane.org; Sat, 02 Aug 2008 21:29:32 +0200 Original-Received: from localhost ([127.0.0.1]:51576 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KPMmI-0007i2-7g for geb-bug-gnu-emacs@m.gmane.org; Sat, 02 Aug 2008 15:28:34 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KPMlJ-0006cC-AL for bug-gnu-emacs@gnu.org; Sat, 02 Aug 2008 15:27:33 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KPMlF-0006a3-Pl for bug-gnu-emacs@gnu.org; Sat, 02 Aug 2008 15:27:31 -0400 Original-Received: from [199.232.76.173] (port=34429 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KPMlD-0006YQ-Uh for bug-gnu-emacs@gnu.org; Sat, 02 Aug 2008 15:27:28 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:59579) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KPMlC-0003uE-84 for bug-gnu-emacs@gnu.org; Sat, 02 Aug 2008 15:27:26 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m72JRLTB003316; Sat, 2 Aug 2008 12:27:23 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m72JF8ZN031939; Sat, 2 Aug 2008 12:15:08 -0700 X-Mailer: MIME-tools 5.420 (Entity 5.420) X-Loop: don@donarmstrong.com X-Emacs-PR-Message: closed 472 X-Emacs-PR-Package: emacs X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:18971 Archived-At: This is a multi-part message in MIME format... ------------=_1217704508-31730-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Your message dated Sat, 02 Aug 2008 15:08:30 -0400 with message-id <873aln2q1d.fsf@stupidchicken.com> and subject line Re: pgg-gpg.el - pgg-gpg-process-region timing problem has caused the Emacs bug report #465, regarding pgg-gpg.el - pgg-gpg-process-region timing problem to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact don@donarmstrong.com immediately.) --=20 465: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=3D465 Emacs Bug Tracking System Contact don@donarmstrong.com with problems ------------=_1217704508-31730-8 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-7.9 required=4.0 tests=BAYES_00,FOURLA, MURPHY_DRUGS_REL8,RCVD_IN_DNSWL_MED autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at submit) by emacsbugs.donarmstrong.com; 23 Jun 2008 17:45:03 +0000 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m5NHiwb9024517 for ; Mon, 23 Jun 2008 10:44:59 -0700 Received: from mail.gnu.org ([199.232.76.166]:42534 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1KAq60-0000J7-Fu for emacs-pretest-bug@gnu.org; Mon, 23 Jun 2008 13:44:52 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1KAq64-0005xq-49 for emacs-pretest-bug@gnu.org; Mon, 23 Jun 2008 13:44:58 -0400 Received: from wf-out-1314.google.com ([209.85.200.173]:55957) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KAq63-0005xK-Co for emacs-pretest-bug@gnu.org; Mon, 23 Jun 2008 13:44:55 -0400 Received: by wf-out-1314.google.com with SMTP id 28so2168156wfc.24 for ; Mon, 23 Jun 2008 10:44:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=BFiYrm+uHvYhYl1juV9NteNrKdxU+pgBanPt5YINoVY=; b=xjliKNOtky0n5An1qegifeq5nxjDWQH441VVqOxtup3TIrd3bySAtcRDnXFeOC0lP7 PMNkRwGtWf42O/pEXjAfYWmTF6GQBGL4ePZnB2LswgPTSTnf/VjPSzjKpcp0+PzNt5w4 ueOXY8p77rwNXIYkuDS1OzX6fkvl1cz7epnJU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=PcJf+wXW+akOLNyZT62a4EE05u9A4SLGUm26YjCEYzuPB4DBzDD+NeZEGJ6Kbryx3T gn2XEWCanloceR3GoQK6Cjjvc0qlMzIdSDQFVamNwDIljh1PcBbJMlKLnjRZqQEN3pnB No3PdZg1l5s5oto1BBxVqebZE+DNO1cg0ISVM= Received: by 10.143.7.5 with SMTP id k5mr4182058wfi.327.1214243092669; Mon, 23 Jun 2008 10:44:52 -0700 (PDT) Received: by 10.114.201.14 with HTTP; Mon, 23 Jun 2008 10:44:52 -0700 (PDT) Message-ID: <2cd46e7f0806231044w6410b825s9611ba713e9ac353@mail.gmail.com> Date: Mon, 23 Jun 2008 13:44:52 -0400 From: "ken manheimer" To: "Thien-Thi Nguyen" Subject: Re: pgg-gpg.el - pgg-gpg-process-region timing problem Cc: wilde@sha-bang.de, emacs-pretest-bug@gnu.org, ueno@unixuser.org, emacs-devel In-Reply-To: <873an4b898.fsf@ambire.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <2cd46e7f0806221037h6d16839bp567eb5b901313375@mail.gmail.com> <87zlpc8t00.fsf@ambire.localdomain> <87r6ao8rty.fsf@ambire.localdomain> <873an4b898.fsf@ambire.localdomain> X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) hi, thi. thanks for the responses - i'm glad to see investigation into this. i've tried both the patches, and both hang for me on the pggprob.el test. the hang is interruptable with Ctl-G keyboard quit. i tried stepping through the second patched version with edebug (including disabling the '(inhibit-redisplay t)' let-binding, which thwarts edebug stepping), and found the hang happens at the first '(accept-process-output process)'. (it hangs at the second one if i don't provide a passphrase.) i'm not sure what's happening. in case it helps, gpg 1.4.6 is what's running on my system. -- ken http://myriadicity.net On Mon, Jun 23, 2008 at 9:17 AM, Thien-Thi Nguyen wrote: > Delving into this, i got a little carried away... full func below. > This adds GOOD_PASSPHRASE checking (necessary for GNUPG 1.4.6, at > least) and some other coding-system related finessing, but removes > the sentinel proposed in the first attempt. In its place, we zonk > the baleful `process-adaptive-read-buffering' and remove timeout > parameters from `accept-process-output' calls. > > With this func things seem to work fine for `pgg-sign' on a small > buffer, and mostly for large buffers (270KB), but sometimes (~10%) > with large buffers, i see a "file error: bad address *GnuPG*". Hmmm... > > thi > > ______________________________________________________________________ > (defun pgg-gpg-process-region (start end passphrase program args) > (let* ((use-agent (and (null passphrase) (pgg-gpg-use-agent-p))) > (output-file-name (pgg-make-temp-file "pgg-output")) > (args > `("--status-fd" "2" > ,@(if use-agent '("--use-agent") > (if passphrase '("--passphrase-fd" "0"))) > "--yes" ; overwrite > "--output" ,output-file-name > ,@pgg-gpg-extra-args ,@args)) > (output-buffer pgg-output-buffer) > (errors-buffer pgg-errors-buffer) > (orig-mode (default-file-modes)) > (inhibit-redisplay t)) > (with-current-buffer (get-buffer-create errors-buffer) > (buffer-disable-undo) > (erase-buffer)) > (unwind-protect > (let* ((coding-system-for-write 'binary) > ;; GNUPG 1.4.6 does not terminate on bad passphrase, eg: > ;; [GNUPG:] BAD_PASSPHRASE (long hex # here) > ;; gpg: skipped "ttn": bad passphrase > ;; gpg: [stdin]: clearsign failed: bad passphrase > ;; so we need to check that condition ourselves and bail out. > ;; > ;; To check if the passphrase is accepted, we need to parse the > ;; errors-buffer, but `process-adaptive-read-buffering' non-nil > ;; sometimes prevents it from filling. So turn it off. > (process-adaptive-read-buffering (not passphrase)) > (process (progn > (set-default-file-modes 448) > (apply #'start-process "*GnuPG*" > errors-buffer program args))) > (status (process-status process)) > > exit-status) > (set-process-sentinel process nil) > (when passphrase > (let ((coding-system-for-write (or pgg-passphrase-coding-system > 'binary))) > (process-send-string process passphrase)) > (process-send-string process "\n") > ;; Bail out if passphrase is not accepted. > ;; MAINTAIN ME: Tested against GNUPG 1.4.6. > (let (result) > (while (not result) > (accept-process-output process) > (with-current-buffer errors-buffer > (save-excursion > (goto-char (point-min)) > (when (re-search-forward > ;; BGM: BAD, GOOD, MISSING. > "^.GNUPG:. \\([BGM][A-Z]+\\)_PASSPHRASE" > nil t) > (setq result (match-string 1)))))) > (unless (string= "GOOD" result) > (error "Passphrase no good")))) > (process-send-region process start end) > (process-send-eof process) > ;; TODO: Re-enable `process-adaptive-read-buffering' here. > (while (eq 'run (setq status (process-status process))) > (accept-process-output process)) > (delete-process process) > (setq exit-status (process-exit-status process)) > (with-current-buffer (get-buffer-create output-buffer) > (buffer-disable-undo) > (erase-buffer) > (if (file-exists-p output-file-name) > (let ((coding-system-for-read (if pgg-text-mode > 'raw-text > 'binary))) > (insert-file-contents output-file-name))) > (set-buffer errors-buffer) > (if (memq status '(stop signal)) > (error "%s exited abnormally: '%s'" program exit-status)) > (if (= 127 exit-status) > (error "%s could not be found" program)))) > (if (file-exists-p output-file-name) > (delete-file output-file-name)) > (when (get-process "*GnuPG*") > (kill-process "*GnuPG*")) > (set-default-file-modes orig-mode)))) ------------=_1217704508-31730-8 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-3.1 required=4.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 465-done) by emacsbugs.donarmstrong.com; 2 Aug 2008 19:08:23 +0000 Received: from cyd (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m72J8K08030048 for <465-done@emacsbugs.donarmstrong.com>; Sat, 2 Aug 2008 12:08:21 -0700 Received: by cyd (Postfix, from userid 1000) id C100F57E337; Sat, 2 Aug 2008 15:08:30 -0400 (EDT) From: Chong Yidong To: 465-done@emacsbugs.donarmstrong.com Subject: Re: pgg-gpg.el - pgg-gpg-process-region timing problem Date: Sat, 02 Aug 2008 15:08:30 -0400 Message-ID: <873aln2q1d.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii I've checked in a fix for this (verified by Ken Manheimer via private email). This fix is in pgg-gpg.el, which I think was calling accept-process-output in a slightly incorrect way. ------------=_1217704508-31730-8--