Gnus development mailing list
 help / color / mirror / Atom feed
From: Miles Bader <miles@gnu.org>
Cc: ding@gnus.org
Subject: pgg merge 5.10 ->trunk ?
Date: Tue, 05 Sep 2006 05:07:54 -0400	[thread overview]
Message-ID: <61wt8iadg5.fsf@fencepost.gnu.org> (raw)

Hi,

Does the following patch need to be merged from Gnus 5.10 into the Gnus
trunk?  [It does not apply, and it's not clear to me whether the changes are
necessary on the trunk or not, as the sources are fairly different in many
areas.]

Thanks,

-Miles

M  lisp/ChangeLog
M  lisp/pgg.el
M  lisp/pgg-gpg.el

--- orig/lisp/ChangeLog
+++ mod/lisp/ChangeLog
@@ -1,3 +1,17 @@
+2006-09-05  Daiki Ueno  <ueno@unixuser.org>
+
+	* pgg.el (pgg-clear-string): Alias to clear-string for backward
+	compatibility.
+
+	* pgg-gpg.el (pgg-gpg-process-region): Avoid display blinking with
+	inhibit-redisplay; encode passphrase with locale-coding-system.
+
+2006-09-04  Daiki Ueno  <ueno@unixuser.org>
+
+	* pgg-gpg.el (pgg-gpg-process-region): Revert two patches from Satyaki
+	Das.  http://article.gmane.org/gmane.emacs.gnus.general/49947
+	http://article.gmane.org/gmane.emacs.gnus.general/50457
+
 2006-09-01  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* rfc2047.el (rfc2047-quote-special-characters-in-quoted-strings):

--- orig/lisp/pgg.el
+++ mod/lisp/pgg.el
@@ -119,5 +119,10 @@
 			  (pgg-truncate-key-identifier key))
 			passphrase)))
 
+(if (fboundp 'clear-string)
+    (defalias 'pgg-clear-string 'clear-string)
+  (defun pgg-clear-string (string)
+    (fillarray string ?_)))
+
 (defun pgg-remove-passphrase-from-cache (key &optional notruncate)
   "Omit passphrase associated with KEY in time-limited passphrase cache.
@@ -137,7 +142,7 @@
          (interned-timer-key (intern-soft key pgg-pending-timers))
          (old-timer (symbol-value interned-timer-key)))
     (when passphrase
-      (fillarray passphrase ?_)
+      (pgg-clear-string passphrase)
       (unintern key pgg-passphrase-cache))
     (when old-timer
       (pgg-cancel-timer old-timer)

--- orig/lisp/pgg-gpg.el
+++ mod/lisp/pgg-gpg.el
@@ -74,23 +74,39 @@
 	 (errors-buffer pgg-errors-buffer)
 	 (orig-mode (default-file-modes))
 	 (process-connection-type nil)
-	 exit-status)
+	 (inhibit-redisplay t)
+	 process status exit-status
+	 passphrase-with-newline
+	 encoded-passphrase-with-new-line)
     (with-current-buffer (get-buffer-create errors-buffer)
       (buffer-disable-undo)
       (erase-buffer))
     (unwind-protect
 	(progn
 	  (set-default-file-modes 448)
-	  (let ((coding-system-for-write 'binary)
-		(input (buffer-substring-no-properties start end))
-		(default-enable-multibyte-characters nil))
-	    (with-temp-buffer
-	      (when passphrase
-		(insert passphrase "\n"))
-	      (insert input)
-	      (setq exit-status
-		    (apply #'call-process-region (point-min) (point-max) program
-			   nil errors-buffer nil args))))
+	  (let ((coding-system-for-write 'binary))
+	    (setq process
+		  (apply #'start-process "*GnuPG*" errors-buffer
+			 program args)))
+	  (set-process-sentinel process #'ignore)
+	  (when passphrase
+	    (setq passphrase-with-newline (concat passphrase "\n"))
+	    (if (boundp 'locale-coding-system)
+		(progn
+		  (setq encoded-passphrase-with-new-line
+			(encode-coding-string passphrase-with-newline
+					      locale-coding-system))
+		  (pgg-clear-string passphrase-with-newline))
+	      (setq encoded-passphrase-with-new-line passphrase-with-newline
+		    passphrase-with-newline nil))
+	    (process-send-string process encoded-passphrase-with-new-line))
+	  (process-send-region process start end)
+	  (process-send-eof process)
+	  (while (eq 'run (process-status process))
+	    (accept-process-output process 5))
+	  (setq status (process-status process)
+		exit-status (process-exit-status process))
+	  (delete-process process)
 	  (with-current-buffer (get-buffer-create output-buffer)
 	    (buffer-disable-undo)
 	    (erase-buffer)
@@ -100,9 +116,16 @@
 						'binary)))
 		  (insert-file-contents output-file-name)))
 	    (set-buffer errors-buffer)
-	    (if (not (equal exit-status 0))
-		(insert (format "\n%s exited abnormally: '%s'\n"
-				program exit-status)))))
+	    (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 passphrase-with-newline
+	  (pgg-clear-string passphrase-with-newline))
+      (if encoded-passphrase-with-new-line
+	  (pgg-clear-string encoded-passphrase-with-new-line))
+      (if (and process (eq 'run (process-status process)))
+	  (interrupt-process process))
       (if (file-exists-p output-file-name)
 	  (delete-file output-file-name))
       (set-default-file-modes orig-mode))))



             reply	other threads:[~2006-09-05  9:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-05  9:07 Miles Bader [this message]
2006-09-05 10:39 ` Daiki Ueno
2006-09-05 10:39   ` Miles Bader

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=61wt8iadg5.fsf@fencepost.gnu.org \
    --to=miles@gnu.org \
    --cc=ding@gnus.org \
    /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).