Subject: epg-wait-for-status hangs forever

From: Richard Stallman <[email-masked]>
Date: Thu, 24 Apr 2014 21:33:25 -0400

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

Yesterday I updated from the trunk and rebuilt.
epa-mail-encrypt and rmail-epa-decrypt now do not terminate.
I got the backtrace below from typing C-g at the latter.

I verified that the call to epg-wait-for-status never returns.
It displays `Decrypting...done', but seems to keep waiting.

I went back to the old Emacs executable from March 19, made from the
trunk fetched on March 18, and aliased function-put to put.  It worked
ok: with the same compiled Lisp files, the hang does not happen.

======================================================================
  accept-process-output(#<process epg<12>> 1)
  epg-wait-for-status((epg-context . [OpenPGP "/usr/bin/X11/gpg" nil nil nil nil nil nil nil (epa-passphrase-callback-function) (epa-progress-callback-function . "Decrypting...") nil nil #<process epg<12>> "/tmp/epg-output127242zO" ((decryption-okay . t) (encrypted-to ("879A7C37B1B10ED6" 16 0))) decrypt nil]) ("BEGIN_DECRYPTION"))
  (if (eq (epg-context-protocol context) (quote CMS)) nil (epg-wait-for-status context (quote ("BEGIN_DECRYPTION"))))
  epg-start-decrypt((epg-context . [OpenPGP "/usr/bin/X11/gpg" nil nil nil nil nil nil nil (epa-passphrase-callback-function) (epa-progress-callback-function . "Decrypting...") nil nil #<process epg<12>> "/tmp/epg-output127242zO" ((decryption-okay . t) (encrypted-to ("879A7C37B1B10ED6" 16 0))) decrypt nil]) (epg-data . ["/tmp/epg-input12724ppI" nil]))
  (progn (write-region cipher nil input-file nil (quote quiet)) (epg-context-set-output-file context (epg--make-temp-file "epg-output")) (epg-start-decrypt context (epg-make-data-from-file input-file)) (epg-wait-for-completion context) (epg--check-error-for-decrypt context) (epg-read-output context))
  (unwind-protect (progn (write-region cipher nil input-file nil (quote quiet)) (epg-context-set-output-file context (epg--make-temp-file "epg-output")) (epg-start-decrypt context (epg-make-data-from-file input-file)) (epg-wait-for-completion context) (epg--check-error-for-decrypt context) (epg-read-output context)) (epg-delete-output-file context) (if (file-exists-p input-file) (delete-file input-file)) (epg-reset context))
  (let ((input-file (epg--make-temp-file "epg-input")) (coding-system-for-write (quote binary))) (unwind-protect (progn (write-region cipher nil input-file nil (quote quiet)) (epg-context-set-output-file context (epg--make-temp-file "epg-output")) (epg-start-decrypt context (epg-make-data-from-file input-file)) (epg-wait-for-completion context) (epg--check-error-for-decrypt context) (epg-read-output context)) (epg-delete-output-file context) (if (file-exists-p input-file) (delete-file input-file)) (epg-reset context)))
  epg-decrypt-string((epg-context . [OpenPGP "/usr/bin/X11/gpg" nil nil nil nil nil nil nil (epa-passphrase-callback-function) (epa-progress-callback-function . "Decrypting...") nil nil #<process epg<12>> "/tmp/epg-output127242zO" ((decryption-okay . t) (encrypted-to ("879A7C37B1B10ED6" 16 0))) decrypt nil]) "-----BEGIN PGP MESSAGE-----\nVersion: GnuPG v1.4.10 (GNU/Linux)\n\nhQEOA4eafDexsQ7WEAQAj/IzHzG41Xl04P9d3aykxHKE4S4AUmCyybhymnVmWdKf\n/22JX7iVIShGB5eyPpiHMkR+l0F6NqclnlDsFyJDfNW++NbL0LY3/Ot86o6KF5Gq\nUP4h1yi6f5VwQI84eMBCM9sst5ZQtyXJXo4+CwovysJEhVz4NbfL+FK3VAlGkzYD\n/37qCj1Ms0M2n8ogCnH4JejW5Qg39dRfWpNd9Noq5JxyH1rKboaTJF+P2GpA60xx\noQJgq1itOoLfgOf8AQhd5JEj4KmwliWbjmZxlN0GMh8xo8+fTIxeOOj0cVLrycW0\nt4Q1fyLG5iThcmWMaGv7wr+chhJCAn3I0quyQ4W5EC2X0ukBUgXKWJzKaRHxU5qG\nMw25QyAbgcYGqrmgKJy2IFkrKAzDZ4qc9OtQB1xJt/0x/LdlrvfNsDvjHaQPNl2u\nkmVE2tzKZVwlkogjlsuFZnn30WSBvlMNRxFSgHJiOHE7Bq98d7VAk111Vw/7LZn6\nPvNZVu61rUSw9KE79nt19lwv4nxFNLr4RDd69jxCaJANvONzFcSxzGcJ1sqjSL4J\nsTNMflaCT/f8QfNzO4PRvV6svPDm2aJOELoY9qQ7sRdGGcSngLTEbjVyLMCTtVgI\nAxtOKqfs4KNIKbBmfkEfxR3ePp5RWDQjKN0dn7JdCKIplMuca1vQurtOo/me9+Xg\nXnHW3lWfneuye03gK907I9G5mTqyf2qWSsQ6yBCEYNoFOLLtr/kOX9x2UB7hNpxs\n9tyEbngYavyQNIQZ7pucTAYwa/eUEzbfONyxPr7PM8fJkI4oY5hK20qJ5zqW8zH6\nhlMhFgO6FSrqViO/YjObD7pTQkj1iKesZB3tlaLx/AqbkKuU7dS0NpcAsj14jwxi\nkLnuv098ZYBZ6YCykz01rk7yCx2qYoV6azcO/Y8Qe2xpk3l+CLVyaiViTQc3JryE\nXtaTUldkJZHvMAQ0RuJa6C4Xk26EFxNPC0esGt6yCJqErkuhY/Gjo3yc+MfOKbB7\n6V/ZBQecgOYBAevzX07fkcfqCnUuUZnapGLSAdm6HQWXhiqVDuhBF6ssyrDv0j5J\nCk3lpoE5kZfHRjAAeIbBEzNH3rn6uCwREVc5ZGe3gcMEEsq94/RGm/EziDSgSdOR\nVhPGEmeRUVfic5pf+Z5NzoJe4aeAVpTl3zPjHUNFjFVu2Hr+ev7lFps=\n=ORAS\n-----END PGP MESSAGE-----")
  (setq plain (epg-decrypt-string context (buffer-substring start end)))
  (let ((context (epg-make-context epa-protocol)) plain) (epg-context-set-passphrase-callback context (function epa-passphrase-callback-function)) (epg-context-set-progress-callback context (cons (function epa-progress-callback-function) "Decrypting...")) (message "Step 2") (sit-for 1) (message "Decrypting...") (setq plain (epg-decrypt-string context (buffer-substring start end))) (message "Step 3") (sit-for 1) (message "Decrypting...done") (debug t) (setq plain (epa--decode-coding-string plain (or coding-system-for-read (get-text-property start (quote epa-coding-system-used)) (quote undecided)))) (message "Decoding done") (if make-buffer-function (save-current-buffer (set-buffer (funcall make-buffer-function)) (let ((inhibit-read-only t)) (insert plain))) (if (y-or-n-p "Replace the original text? ") (let ((inhibit-read-only t)) (delete-region start end) (goto-char start) (insert plain)) (let* ((old-dir default-directory) (buf (save-current-buffer (set-buffer ...) (prog1 ... ... ... ... ... ... ...))) (standard-output buf)) (prog1 (progn (set-buffer standard-output) (insert plain) (epa-info-mode)) (internal-temp-output-buffer-show buf))))) (if (epg-context-result-for context (quote verify)) (epa-display-info (epg-verify-result-to-string (epg-context-result-for context (quote verify))))))
  (save-excursion (let ((context (epg-make-context epa-protocol)) plain) (epg-context-set-passphrase-callback context (function epa-passphrase-callback-function)) (epg-context-set-progress-callback context (cons (function epa-progress-callback-function) "Decrypting...")) (message "Step 2") (sit-for 1) (message "Decrypting...") (setq plain (epg-decrypt-string context (buffer-substring start end))) (message "Step 3") (sit-for 1) (message "Decrypting...done") (debug t) (setq plain (epa--decode-coding-string plain (or coding-system-for-read (get-text-property start (quote epa-coding-system-used)) (quote undecided)))) (message "Decoding done") (if make-buffer-function (save-current-buffer (set-buffer (funcall make-buffer-function)) (let ((inhibit-read-only t)) (insert plain))) (if (y-or-n-p "Replace the original text? ") (let ((inhibit-read-only t)) (delete-region start end) (goto-char start) (insert plain)) (let* ((old-dir default-directory) (buf (save-current-buffer ... ...)) (standard-output buf)) (prog1 (progn (set-buffer standard-output) (insert plain) (epa-info-mode)) (internal-temp-output-buffer-show buf))))) (if (epg-context-result-for context (quote verify)) (epa-display-info (epg-verify-result-to-string (epg-context-result-for context (quote verify)))))))
  epa-decrypt-region(1 1323 (lambda nil (let ((inhibit-read-only t)) (delete-region armor-start armor-end) (goto-char armor-start) (current-buffer))))
  (let ((coding-system-for-read coding-system-for-read) armor-start armor-end after-end) (setq armor-start (match-beginning 0) armor-end (re-search-forward "^-----END PGP MESSAGE-----$" nil t)) (if armor-end nil (error "Encryption armor beginning has no matching end")) (goto-char armor-start) (require (quote epa)) (if coding-system-for-read nil (if (re-search-forward "^Charset: \\(.*\\)" armor-end t) (setq coding-system-for-read (epa--find-coding-system-for-mime-charset (intern (downcase (match-string 1))))))) (goto-char armor-end) (setq after-end (- (point-max) armor-end)) (epa-decrypt-region armor-start armor-end (function (lambda nil (let ((inhibit-read-only t)) (delete-region armor-start armor-end) (goto-char armor-start) (current-buffer))))) (setq decrypts (cons (list armor-start (- (point-max) after-end)) decrypts)))
  (while (re-search-forward "-----BEGIN PGP MESSAGE-----$" nil t) (let ((coding-system-for-read coding-system-for-read) armor-start armor-end after-end) (setq armor-start (match-beginning 0) armor-end (re-search-forward "^-----END PGP MESSAGE-----$" nil t)) (if armor-end nil (error "Encryption armor beginning has no matching end")) (goto-char armor-start) (require (quote epa)) (if coding-system-for-read nil (if (re-search-forward "^Charset: \\(.*\\)" armor-end t) (setq coding-system-for-read (epa--find-coding-system-for-mime-charset (intern (downcase ...)))))) (goto-char armor-end) (setq after-end (- (point-max) armor-end)) (epa-decrypt-region armor-start armor-end (function (lambda nil (let ((inhibit-read-only t)) (delete-region armor-start armor-end) (goto-char armor-start) (current-buffer))))) (setq decrypts (cons (list armor-start (- (point-max) after-end)) decrypts))))
  (let (decrypts) (goto-char (point-min)) (if (and (rmail-mime-message-p) (not (get-text-property (point-min) (quote rmail-mime-hidden)))) (progn (rmail-mime))) (goto-char (point-min)) (while (re-search-forward "-----BEGIN PGP MESSAGE-----$" nil t) (let ((coding-system-for-read coding-system-for-read) armor-start armor-end after-end) (setq armor-start (match-beginning 0) armor-end (re-search-forward "^-----END PGP MESSAGE-----$" nil t)) (if armor-end nil (error "Encryption armor beginning has no matching end")) (goto-char armor-start) (require (quote epa)) (if coding-system-for-read nil (if (re-search-forward "^Charset: \\(.*\\)" armor-end t) (setq coding-system-for-read (epa--find-coding-system-for-mime-charset (intern ...))))) (goto-char armor-end) (setq after-end (- (point-max) armor-end)) (epa-decrypt-region armor-start armor-end (function (lambda nil (let (...) (delete-region armor-start armor-end) (goto-char armor-start) (current-buffer))))) (setq decrypts (cons (list armor-start (- (point-max) after-end)) decrypts)))) (if (and decrypts (rmail-buffers-swapped-p)) (progn (if (y-or-n-p "Replace the original message? ") (progn (setq decrypts (nreverse decrypts)) (let ((beg ...) (end ...) (from-buffer ...)) (save-current-buffer (set-buffer rmail-view-buffer) (narrow-to-region beg end) (goto-char ...) (let ... ...))))))))
  (save-excursion (let (decrypts) (goto-char (point-min)) (if (and (rmail-mime-message-p) (not (get-text-property (point-min) (quote rmail-mime-hidden)))) (progn (rmail-mime))) (goto-char (point-min)) (while (re-search-forward "-----BEGIN PGP MESSAGE-----$" nil t) (let ((coding-system-for-read coding-system-for-read) armor-start armor-end after-end) (setq armor-start (match-beginning 0) armor-end (re-search-forward "^-----END PGP MESSAGE-----$" nil t)) (if armor-end nil (error "Encryption armor beginning has no matching end")) (goto-char armor-start) (require (quote epa)) (if coding-system-for-read nil (if (re-search-forward "^Charset: \\(.*\\)" armor-end t) (setq coding-system-for-read (epa--find-coding-system-for-mime-charset ...)))) (goto-char armor-end) (setq after-end (- (point-max) armor-end)) (epa-decrypt-region armor-start armor-end (function (lambda nil (let ... ... ... ...)))) (setq decrypts (cons (list armor-start (- ... after-end)) decrypts)))) (if (and decrypts (rmail-buffers-swapped-p)) (progn (if (y-or-n-p "Replace the original message? ") (progn (setq decrypts (nreverse decrypts)) (let (... ... ...) (save-current-buffer ... ... ... ...))))))))
  rmail-epa-decrypt()

-- 
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org  www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
  Use Ekiga or an ordinary phone call.