From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/62489 Path: news.gmane.org!not-for-mail From: Daiki Ueno Newsgroups: gmane.emacs.gnus.general Subject: Re: "[GNUPG:] TRUST_UNDEFINED" not indicated Date: Tue, 04 Apr 2006 11:39:08 +0900 Message-ID: <9c6b9431-3071-43f6-9e2b-4e582bc38a42@well-done.deisui.org> References: <2cd46e7f0510031250u66ea1349yb437d539ce4027ef@mail.gmail.com> <87lkv1whmh.fsf@latte.josefsson.org> <897751e5-a148-4109-8da6-6f69cce0dec0@well-done.deisui.org> <87d5gd2ts1.fsf@latte.josefsson.org> <87wteiypvv.fsf@latte.josefsson.org> <87irq1evdk.fsf@catnip.gol.com> <0443f268-1caf-4aef-9a06-daa4a59b0682@well-done.deisui.org> <87slp587cw.fsf@latte.josefsson.org> <87odzs8c0a.fsf@latte.josefsson.org> <87lkurytqu.fsf@pacem.orebokech.com> <874q1dr7fi.fsf@latte.josefsson.org> <874q1d645k.fsf@pacem.orebokech.com> <5772fa8a-0f53-4232-9522-a97835b413e7@well-done.deisui.org> <873bgvcaew.fsf@pacem.orebokech.com> <87u09batzr.fsf@pacem.orebokech.com> <87u09b6m7t.fsf@latte.josefsson.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart_Tue_Apr__4_11:39:08_2006-1" X-Trace: sea.gmane.org 1144118576 4448 80.91.229.2 (4 Apr 2006 02:42:56 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 4 Apr 2006 02:42:56 +0000 (UTC) Cc: Romain Francoise , Reiner Steib , Original-X-From: ding-owner+m11016@lists.math.uh.edu Tue Apr 04 04:42:53 2006 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FQbVK-0007nE-Ik for ding-account@gmane.org; Tue, 04 Apr 2006 04:42:50 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1FQbVB-000154-00; Mon, 03 Apr 2006 21:42:41 -0500 Original-Received: from nas01.math.uh.edu ([129.7.128.39]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1FQbRv-00014y-00 for ding@lists.math.uh.edu; Mon, 03 Apr 2006 21:39:19 -0500 Original-Received: from quimby.gnus.org ([80.91.224.244]) by nas01.math.uh.edu with esmtp (Exim 4.52) id 1FQbRu-0007AD-F0 for ding@lists.math.uh.edu; Mon, 03 Apr 2006 21:39:19 -0500 Original-Received: from g96069.scn-net.ne.jp ([210.231.96.69] helo=well-done.deisui.org) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1FQbRs-0001Ds-00 for ; Tue, 04 Apr 2006 04:39:17 +0200 Original-Received: from [150.82.173.221] (helo=well-done.deisui.org) by well-done.deisui.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1FQbRm-0002Ai-Qk; Tue, 04 Apr 2006 11:39:11 +0900 Original-To: Simon Josefsson X-Attribution: DU In-Reply-To: <87u09b6m7t.fsf@latte.josefsson.org> (Simon Josefsson's message of "Mon, 03 Apr 2006 11:29:42 +0200") User-Agent: T-gnus/6.17.2 (based on No Gnus v0.2) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 MULE XEmacs/21.4 (patch 17) (Jumbo Shrimp) (i686-pc-linux) X-Spam-Score: -0.5 (/) Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu Xref: news.gmane.org gmane.emacs.gnus.general:62489 Archived-At: --Multipart_Tue_Apr__4_11:39:08_2006-1 Content-Type: text/plain; charset=US-ASCII >>>>> In <87u09b6m7t.fsf@latte.josefsson.org> >>>>> Simon Josefsson wrote: > Romain Francoise writes: > > Daiki Ueno writes: > > > >>> | error in process filter: sit-for: Selecting deleted buffer > >>> | error in process filter: Selecting deleted buffer > > > >> I hope this patch will help you. > > > > It does: with this patch on top of your previous fix everything works as > > intended, as far as I can see. Simon, could you install it? > Done! Thanks for testing. Sorry for bothering you again, Romain, could you test the attached patch? It would be better fix for that problem since it makes sure to clean up process buffers every time gpg processes complete. > If some more problem is discovered, maybe we should back out these > changes from v5-10. They can be tested on the trunk, and moved back > to v5-10 in time for 5.10.9. Yes, I agree. --Multipart_Tue_Apr__4_11:39:08_2006-1 Content-Type: application/octet-stream; type=patch Content-Disposition: attachment; filename="pgg-gpg.el.diff" Content-Transfer-Encoding: 7bit Index: lisp/pgg-gpg.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/pgg-gpg.el,v retrieving revision 7.19 diff -u -r7.19 pgg-gpg.el --- lisp/pgg-gpg.el 3 Apr 2006 09:10:40 -0000 7.19 +++ lisp/pgg-gpg.el 4 Apr 2006 02:27:53 -0000 @@ -106,13 +106,13 @@ process)) (defun pgg-gpg-process-filter (process input) + (if pgg-gpg-debug + (save-excursion + (set-buffer (get-buffer-create " *pgg-gpg-debug*")) + (goto-char (point-max)) + (insert input))) (if (buffer-live-p (process-buffer process)) (save-excursion - (if pgg-gpg-debug - (save-excursion - (set-buffer (get-buffer-create " *pgg-gpg-debug*")) - (goto-char (point-max)) - (insert input))) (set-buffer (process-buffer process)) (goto-char (point-max)) (insert input) @@ -130,39 +130,39 @@ pgg-gpg-pending-status-list))) (if (and symbol (fboundp symbol)) - (funcall symbol process (buffer-substring (match-beginning 1) - (match-end 0))))))) + (funcall symbol process (buffer-substring + (match-beginning 1) + (match-end 0))))))) (forward-line)) (setq pgg-gpg-read-point (point))))) (defun pgg-gpg-process-sentinel (process status) - (set-process-filter process nil) - (save-excursion - ;; Copy the contents of process-buffer to pgg-errors-buffer. - (set-buffer (get-buffer-create pgg-errors-buffer)) - (buffer-disable-undo) - (erase-buffer) - (when (buffer-live-p (process-buffer process)) - (insert-buffer-substring (process-buffer process)) - (goto-char (point-min)) - ;(delete-matching-lines "^\\[GNUPG:] ") - (goto-char (point-min)) - (while (re-search-forward "^gpg: " nil t) - (replace-match ""))) - ;; Read the contents of the output file to pgg-output-buffer. - (set-buffer (get-buffer-create pgg-output-buffer)) - (buffer-disable-undo) - (erase-buffer) - (if (and (equal status "finished\n") - (buffer-live-p (process-buffer process))) - (let ((output-file-name (with-current-buffer (process-buffer process) - pgg-gpg-output-file-name))) - (when (file-exists-p output-file-name) - (let ((coding-system-for-read (if pgg-text-mode - 'raw-text - 'binary))) - (insert-file-contents output-file-name)) - (delete-file output-file-name)))))) + (if (buffer-live-p (process-buffer process)) + (save-excursion + (set-buffer (process-buffer process)) + (when pgg-gpg-passphrase + (fillarray pgg-gpg-passphrase 0) + (setq pgg-gpg-passphrase nil)) + ;; Copy the contents of process-buffer to pgg-errors-buffer. + (set-buffer (get-buffer-create pgg-errors-buffer)) + (buffer-disable-undo) + (erase-buffer) + (insert-buffer-substring (process-buffer process)) + ;; Read the contents of the output file to pgg-output-buffer. + (set-buffer (get-buffer-create pgg-output-buffer)) + (buffer-disable-undo) + (erase-buffer) + (if (equal status "finished\n") + (let ((output-file-name + (with-current-buffer (process-buffer process) + pgg-gpg-output-file-name))) + (when (file-exists-p output-file-name) + (let ((coding-system-for-read (if pgg-text-mode + 'raw-text + 'binary))) + (insert-file-contents output-file-name)) + (delete-file output-file-name)))) + (kill-buffer (process-buffer process))))) (defun pgg-gpg-wait-for-status (process status-list) (with-current-buffer (process-buffer process) @@ -171,24 +171,12 @@ pgg-gpg-pending-status-list) (accept-process-output process 1)))) -(defun pgg-gpg-wait-for-completion (process &optional status-list) +(defun pgg-gpg-wait-for-completion (process) (process-send-eof process) (while (eq (process-status process) 'run) - (sit-for 0.1)) - (if (buffer-live-p (process-buffer process)) - (save-excursion - (set-buffer (process-buffer process)) - (setq status-list (copy-sequence status-list)) - (let ((pointer status-list)) - (while pointer - (goto-char (point-min)) - (unless (re-search-forward - (concat "^\\[GNUPG:] " (car pointer) "\\>") - nil t) - (setq status-list (delq (car pointer) status-list))) - (setq pointer (cdr pointer)))) - (kill-buffer (process-buffer process)) - status-list))) + ;; We can't use accept-process-output instead of sit-for here + ;; because it may cause an interrupt during the sentinel execution. + (sit-for 0.1))) (defun pgg-gpg-status-USERID_HINT (process line) (if (string-match "\\`USERID_HINT \\([^ ]+\\) \\(.*\\)" line) @@ -270,7 +258,12 @@ (if (and sign (not pgg-gpg-use-agent)) (pgg-gpg-wait-for-status process '("GOOD_PASSPHRASE"))) (process-send-region process start end) - (pgg-gpg-wait-for-completion process '("SIG_CREATED" "END_ENCRYPTION")))) + (pgg-gpg-wait-for-completion process) + (save-excursion + (set-buffer (get-buffer-create pgg-errors-buffer)) + (goto-char (point-max)) + (not (null (re-search-backward "^\\[GNUPG:] END_ENCRYPTION\\>" + nil t)))))) (defun pgg-gpg-encrypt-symmetric-region (start end &optional passphrase) "Encrypt the current region between START and END with symmetric cipher." @@ -280,7 +273,12 @@ (process (pgg-gpg-start-process args))) (pgg-gpg-wait-for-status process '("BEGIN_ENCRYPTION")) (process-send-region process start end) - (pgg-gpg-wait-for-completion process '("END_ENCRYPTION")))) + (pgg-gpg-wait-for-completion process) + (save-excursion + (set-buffer (get-buffer-create pgg-errors-buffer)) + (goto-char (point-max)) + (not (null (re-search-backward "^\\[GNUPG:] END_ENCRYPTION\\>" + nil t)))))) (defun pgg-gpg-decrypt-region (start end &optional passphrase) "Decrypt the current region between START and END." @@ -288,7 +286,12 @@ (process (pgg-gpg-start-process args))) (process-send-region process start end) (pgg-gpg-wait-for-status process '("BEGIN_DECRYPTION")) - (pgg-gpg-wait-for-completion process '("GOODSIG" "DECRYPTION_OKAY")))) + (pgg-gpg-wait-for-completion process) + (save-excursion + (set-buffer (get-buffer-create pgg-errors-buffer)) + (goto-char (point-max)) + (not (null (re-search-backward "^\\[GNUPG:] DECRYPTION_OKAY\\>" + nil t)))))) (defun pgg-gpg-sign-region (start end &optional cleartext passphrase) "Make detached signature from text between START and END." @@ -302,7 +305,12 @@ (unless pgg-gpg-use-agent (pgg-gpg-wait-for-status process '("GOOD_PASSPHRASE"))) (process-send-region process start end) - (pgg-gpg-wait-for-completion process '("SIG_CREATED")))) + (pgg-gpg-wait-for-completion process) + (save-excursion + (set-buffer (get-buffer-create pgg-errors-buffer)) + (goto-char (point-max)) + (not (null (re-search-backward "^\\[GNUPG:] SIG_CREATED\\>" + nil t)))))) (defun pgg-gpg-verify-region (start end &optional signature) "Verify region between START and END as the detached signature SIGNATURE." @@ -312,7 +320,12 @@ (setq args (append args (list signature)))) (setq process (pgg-gpg-start-process (append args '("-")))) (process-send-region process start end) - (pgg-gpg-wait-for-completion process '("GOODSIG")))) + (pgg-gpg-wait-for-completion process) + (save-excursion + (set-buffer (get-buffer-create pgg-errors-buffer)) + (goto-char (point-max)) + (not (null (re-search-backward "^\\[GNUPG:] GOODSIG\\>" + nil t)))))) (defun pgg-gpg-insert-key () "Insert public key at point." @@ -329,7 +342,12 @@ (process (pgg-gpg-start-process args)) status) (process-send-region process start end) - (pgg-gpg-wait-for-completion process '("IMPORT_RES")))) + (pgg-gpg-wait-for-completion process) + (save-excursion + (set-buffer (get-buffer-create pgg-errors-buffer)) + (goto-char (point-max)) + (not (null (re-search-backward "^\\[GNUPG:] IMPORT_RES\\>" + nil t)))))) (provide 'pgg-gpg) --Multipart_Tue_Apr__4_11:39:08_2006-1 Content-Type: text/plain; charset=US-ASCII Regards, -- Daiki Ueno --Multipart_Tue_Apr__4_11:39:08_2006-1--