Gnus development mailing list
 help / color / mirror / Atom feed
From: Daiki Ueno <ueno@unixuser.org>
Cc: Romain Francoise <romain@orebokech.com>,
	Reiner Steib <Reiner.Steib@gmx.de>,  <ding@gnus.org>
Subject: Re: "[GNUPG:] TRUST_UNDEFINED" not indicated
Date: Tue, 04 Apr 2006 11:39:08 +0900	[thread overview]
Message-ID: <9c6b9431-3071-43f6-9e2b-4e582bc38a42@well-done.deisui.org> (raw)
In-Reply-To: <87u09b6m7t.fsf@latte.josefsson.org> (Simon Josefsson's message of "Mon, 03 Apr 2006 11:29:42 +0200")

[-- Attachment #1: Type: text/plain, Size: 922 bytes --]

>>>>> In <87u09b6m7t.fsf@latte.josefsson.org> 
>>>>>	Simon Josefsson <jas@extundo.com> wrote:
> Romain Francoise <romain@orebokech.com> writes:

> > Daiki Ueno <ueno@unixuser.org> 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.


[-- Attachment #2: pgg-gpg.el.diff --]
[-- Type: application/octet-stream, Size: 8030 bytes --]

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)
 

[-- Attachment #3: Type: text/plain, Size: 25 bytes --]


Regards,
-- 
Daiki Ueno

  parent reply	other threads:[~2006-04-04  2:39 UTC|newest]

Thread overview: 121+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2cd46e7f0510031250u66ea1349yb437d539ce4027ef@mail.gmail.com>
     [not found] ` <2cd46e7f0510061541w73bb6a92wb6d22829b6e804ae@mail.gmail.com>
     [not found]   ` <20051007100014.GB4850@kenny.sha-bang.local>
     [not found]     ` <2cd46e7f0510071106k3d4d3e6agc36f16a37d8b6bc6@mail.gmail.com>
     [not found]       ` <20051007214952.GA30235@kenny.sha-bang.local>
     [not found]         ` <iluvf08mm1w.fsf@latte.josefsson.org>
     [not found]           ` <20051008103627.GA1218@kenny.sha-bang.local>
     [not found]             ` <2cd46e7f0510081131h14e2bbeaga7f1a33ebd6347c8@mail.gmail.com>
     [not found]               ` <2cd46e7f0510101415t76825ea7u9749fe23da54ce@mail.gmail.com>
     [not found]                 ` <2cd46e7f0510121647x3c51fb65pc883ed61f4e864ab@mail.gmail.com>
     [not found]                   ` <2cd46e7f0510200708x4640d1c2t50743cf439e52dd4@mail.gmail.com>
     [not found]                     ` <ilur7ag8efp.fsf@latte.josefsson.org>
2006-03-18 21:17                       ` Small patch to enable use of gpg-agent with pgg Sascha Wilde
2006-03-18 23:30                         ` Daniel Pittman
2006-03-19  0:46                           ` Miles Bader
2006-03-19  3:45                             ` Daniel Pittman
2006-03-19 18:28                               ` Miles Bader
2006-03-19  9:49                           ` Sascha Wilde
2006-03-19 17:30                             ` Sascha Wilde
2006-03-21 14:32                         ` Simon Josefsson
2006-03-21 21:29                           ` Reiner Steib
2006-03-22  9:49                             ` Simon Josefsson
2006-03-22  8:36                           ` Sascha Wilde
2006-03-22  9:16                             ` Daiki Ueno
2006-03-22  9:48                               ` Simon Josefsson
2006-03-22 11:03                               ` Sascha Wilde
2006-03-22 11:13                                 ` Simon Josefsson
2006-03-22 12:25                                   ` Daiki Ueno
2006-03-23 10:40                                     ` Daiki Ueno
2006-03-23 11:00                                       ` Simon Josefsson
2006-03-23 12:18                                         ` Daiki Ueno
2006-03-23 13:08                                           ` Simon Josefsson
2006-03-24  5:51                                             ` Daiki Ueno
2006-03-26  0:29                                               ` Daiki Ueno
2006-03-26  1:08                                                 ` Simon Josefsson
2006-03-26  3:29                                                   ` Miles Bader
2006-03-26  5:06                                                     ` Daiki Ueno
2006-03-26 17:05                                                       ` Simon Josefsson
2006-03-26 18:24                                                         ` Sascha Wilde
2006-03-27  9:36                                                           ` Simon Josefsson
2006-03-31  7:10                                                             ` Romain Francoise
2006-04-01  9:06                                                               ` Simon Josefsson
2006-04-01  9:23                                                                 ` Romain Francoise
2006-04-03  8:14                                                                   ` "[GNUPG:] TRUST_UNDEFINED" not indicated (was: Small patch to enable use of gpg-agent with pgg) Reiner Steib
2006-04-03  8:32                                                                     ` "[GNUPG:] TRUST_UNDEFINED" not indicated Daiki Ueno
2006-04-03  8:48                                                                       ` Romain Francoise
2006-04-03  9:00                                                                         ` Daiki Ueno
2006-04-03  9:28                                                                           ` Romain Francoise
2006-04-03  9:29                                                                             ` Simon Josefsson
2006-04-03 16:42                                                                               ` Adam Sjøgren
2006-04-03 17:00                                                                                 ` Romain Francoise
2006-04-03 17:13                                                                                   ` Adam Sjøgren
2006-04-04  2:39                                                                               ` Daiki Ueno [this message]
2006-04-04  7:18                                                                                 ` Romain Francoise
2006-04-04 10:35                                                                                   ` Simon Josefsson
2006-04-04 22:58                                                                                     ` Reiner Steib
2006-04-04 23:30                                                                                       ` Simon Josefsson
2006-04-03  8:49                                                                     ` "[GNUPG:] TRUST_UNDEFINED" not indicated (was: Small patch to Simon Josefsson
2006-04-05  1:52                                                         ` pgg-gpg: BEGIN_SIGNING Daiki Ueno
2006-04-05  8:40                                                           ` Simon Josefsson
2006-04-05 10:06                                                             ` Daiki Ueno
2006-04-05 11:02                                                               ` Simon Josefsson
2006-04-05 11:46                                                                 ` Daiki Ueno
2006-04-05 13:01                                                                   ` Simon Josefsson
2006-04-05 15:21                                                                     ` Please test current GPG features (was: pgg-gpg: BEGIN_SIGNING) Reiner Steib
2006-04-05 15:31                                                                       ` Please test current GPG features Simon Josefsson
2006-04-05 16:17                                                                         ` Reiner Steib
2006-04-18  8:56                                                                           ` Simon Josefsson
2006-04-19 10:03                                                                             ` Daiki Ueno
2006-04-19 10:39                                                                               ` Simon Josefsson
2006-04-06 10:40                                                                         ` Reiner Steib
2006-04-06 11:02                                                                           ` Simon Josefsson
2006-04-06 13:01                                                                             ` Reiner Steib
2006-04-06 13:41                                                                               ` Simon Josefsson
2006-04-06 16:20                                                                               ` Romain Francoise
2006-04-06 18:08                                                                                 ` Romain Francoise
2006-04-06 18:27                                                                                   ` Reiner Steib
2006-04-06 18:36                                                                                     ` Romain Francoise
2006-03-23 12:52                                       ` Small patch to enable use of gpg-agent with pgg Sascha Wilde
2006-03-23 20:07                                         ` Daiki Ueno
2006-03-23 22:16                                           ` Sascha Wilde
2006-04-05  9:13                                             ` pgg-gpg broken? Sascha Wilde
2006-04-05  9:42                                               ` Daiki Ueno
2006-04-05 10:18                                                 ` Sascha Wilde
2006-04-05 21:33                                                   ` Daiki Ueno
2006-04-06  9:00                                                     ` Sascha Wilde
2006-04-06  9:21                                                       ` Daiki Ueno
2006-04-06  9:58                                                         ` Sascha Wilde
2006-04-06 10:13                                                           ` Daiki Ueno
2006-04-07 10:32                                                           ` gpg-agent support removed?! (was: pgg-gpg broken?) Sascha Wilde
2006-04-07 12:11                                                             ` Simon Josefsson
2006-04-07 12:14                                                             ` gpg-agent support removed?! Romain Francoise
2006-04-07 13:00                                                               ` Sascha Wilde
2006-04-07 13:30                                                                 ` Simon Josefsson
2006-04-07 20:59                                                                   ` Reiner Steib
2006-04-08  9:36                                                                 ` Romain Francoise
2006-04-08 10:05                                                                   ` Sascha Wilde
2006-04-07 12:35                                                             ` Reiner Steib
2006-04-07 13:02                                                               ` Daiki Ueno
2006-04-07 13:08                                                                 ` Sascha Wilde
2006-04-07 13:26                                                                   ` Daiki Ueno
2006-04-09 16:04                                                                     ` Sascha Wilde
2006-04-10 18:04                                                                       ` Reiner Steib
2006-04-07 13:40                                                                   ` Reiner Steib
2006-04-07 14:05                                                                 ` Thomas Baumann
2006-04-07 14:40                                                                   ` Daiki Ueno
2006-04-07 15:45                                                                     ` Reiner Steib
2006-04-07 20:55                                                                       ` Daiki Ueno
2006-04-07 21:22                                                                         ` Reiner Steib
2006-04-08  7:03                                                                           ` Thomas Baumann
2006-04-08 10:18                                                                           ` Daiki Ueno
     [not found]                                                               ` <E1FRydQ-0007gN-9f@fencepost.gnu.org>
     [not found]                                                                 ` <873bgo4d0e.fsf@pacem.orebokech.com>
     [not found]                                                                   ` <d215ebff-cfee-4d23-852b-86f1f0d955b8@well-done.deisui.org>
     [not found]                                                                     ` <87r7482tjt.fsf@pacem.orebokech.com>
     [not found]                                                                       ` <fa2c4f80-3b38-4a6c-99ac-ff8dbd1c99f4@well-done.deisui.org>
2006-04-10 18:04                                                                         ` PGG maintainance (was: gpg-agent support removed?!) Reiner Steib
2006-04-05 16:14                                               ` pgg-gpg broken? Reiner Steib
2006-04-05 19:22                                                 ` Sascha Wilde
2006-03-22  9:46                             ` Small patch to enable use of gpg-agent with pgg Simon Josefsson
2006-03-22 16:13                             ` Simon Josefsson
2006-03-22 23:01                               ` Katsumi Yamaoka
2006-03-22 23:45                                 ` Simon Josefsson
2006-03-23  0:58                                   ` Katsumi Yamaoka
2006-03-23  9:12                                     ` Simon Josefsson
2006-03-23 10:26                                       ` Sascha Wilde
2006-03-23 10:54                                         ` Simon Josefsson
2006-03-23 11:12                                           ` Simon Josefsson
2006-03-23 11:16                                             ` Simon Josefsson
2006-03-23 12:51                                               ` Reiner Steib
2006-03-23 13:07                                                 ` Sascha Wilde
2006-03-23 13:10                                                   ` Simon Josefsson
2006-03-23 12:00                                             ` Sascha Wilde
2006-03-23 13:00                                               ` Simon Josefsson
2006-03-26 18:11                                                 ` Sascha Wilde
     [not found]                                             ` <m2wtels74l.fsf@kenny.sha-bang .de>
2006-03-23 23:09                                               ` Miles Bader
2006-04-02  0:30                                                 ` Ken Manheimer
2006-04-02  8:28                                                   ` Daiki Ueno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9c6b9431-3071-43f6-9e2b-4e582bc38a42@well-done.deisui.org \
    --to=ueno@unixuser.org \
    --cc=Reiner.Steib@gmx.de \
    --cc=ding@gnus.org \
    --cc=romain@orebokech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).