GNU bug report logs - #469
pgg-gpg.el - pgg-gpg-process-region timing problem

Previous Next

Package: emacs;

Reported by: Thien-Thi Nguyen <ttn <at> gnuvola.org>

Date: Mon, 23 Jun 2008 08:55:05 UTC

Severity: normal

Merged with 465, 470, 471, 472, 474, 476, 486, 487

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 469 in the body.
You can then email your comments to 469 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#469; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Thien-Thi Nguyen <ttn <at> gnuvola.org>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Thien-Thi Nguyen <ttn <at> gnuvola.org>
To: "ken manheimer" <ken.manheimer <at> gmail.com>
Cc: wilde <at> sha-bang.de, emacs-pretest-bug <at> gnu.org, ueno <at> unixuser.org,
        emacs-devel <emacs-devel <at> gnu.org>
Subject: Re: pgg-gpg.el - pgg-gpg-process-region timing problem
Date: Mon, 23 Jun 2008 10:43:05 +0200
ChangeLog entry:

	Use process sentinel to monitor gpg subprocess status.

	* pgg-gpg.el (pgg-gpg-process-region): Fix omission bug:
	Use process sentinel to update process status and exit-status.
	Reported by ken manheimer <ken.manheimer <at> gmail.com>.

patch:
*** pgg-gpg.el	6 May 2008 07:57:46 -0000	1.27
--- pgg-gpg.el	23 Jun 2008 08:40:50 -0000
***************
*** 70,111 ****
  	    ,@pgg-gpg-extra-args ,@args))
  	 (output-buffer pgg-output-buffer)
  	 (errors-buffer pgg-errors-buffer)
! 	 (orig-mode (default-file-modes))
! 	 (process-connection-type nil)
! 	 (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))
! 	    (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 pgg-passphrase-coding-system
! 		(progn
! 		  (setq encoded-passphrase-with-new-line
  			(encode-coding-string
! 			 passphrase-with-newline
! 			 (coding-system-change-eol-conversion
! 			  pgg-passphrase-coding-system 'unix)))
! 		  (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)
--- 70,104 ----
  	    ,@pgg-gpg-extra-args ,@args))
  	 (output-buffer pgg-output-buffer)
  	 (errors-buffer pgg-errors-buffer)
! 	 (inhibit-redisplay t))
      (with-current-buffer (get-buffer-create errors-buffer)
        (buffer-disable-undo)
        (erase-buffer))
      (unwind-protect
! 	(let* ((coding-system-for-write 'binary)
! 	       (process (let ((orig (default-file-modes)))
  			  (set-default-file-modes 448)
! 			  (prog1 (apply #'start-process "*GnuPG*"
! 					errors-buffer program args)
! 			    (set-default-file-modes orig))))
! 	       (status (process-status process))
! 	       exit-status)
! 	  (set-process-sentinel
! 	   process (lambda (process reason)
! 		     (setq status (process-status process)
! 			   exit-status (process-exit-status process))))
  	  (when passphrase
! 	    (process-send-string
! 	     process (if pgg-passphrase-coding-system
  			 (encode-coding-string
! 			  passphrase
! 			  pgg-passphrase-coding-system)
! 		       passphrase))
! 	    (process-send-string process "\n"))
  	  (process-send-region process start end)
  	  (process-send-eof process)
! 	  (while (eq 'run status)
  	    (accept-process-output process 5))
  	  (delete-process process)
  	  (with-current-buffer (get-buffer-create output-buffer)
  	    (buffer-disable-undo)
***************
*** 120,134 ****
  		(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))))
  
  (defun pgg-gpg-possibly-cache-passphrase (passphrase &optional key notruncate)
    (if (and passphrase
--- 113,120 ----
  		(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)))))
  
  (defun pgg-gpg-possibly-cache-passphrase (passphrase &optional key notruncate)
    (if (and passphrase




Merged 465 469 470 471 472 474 476 486 487. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Sat, 28 Jun 2008 00:15:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <don <at> donarmstrong.com> to internal_control <at> emacsbugs.donarmstrong.com. (Sun, 31 Aug 2008 14:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 291 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.