GNU bug report logs - #26298
26.0.50; Gnus fails to sign mail with PGP

Previous Next

Packages: emacs, gnus;

Reported by: Torsten Bronger <bronger <at> physik.rwth-aachen.de>

Date: Wed, 29 Mar 2017 12:13:01 UTC

Severity: normal

Tags: fixed

Fixed in version 27.1

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Noam Postavsky <npostavs <at> gmail.com>
To: Toon Claes <toon <at> iotcl.com>
Cc: Joseph Mingrone <jrm <at> ftfl.ca>, 26298 <at> debbugs.gnu.org, Torsten Bronger <bronger <at> physik.rwth-aachen.de>
Subject: bug#26298: 26.0.50; Gnus fails to sign mail with PGP
Date: Thu, 17 May 2018 19:41:15 -0400
[Message part 1 (text/plain, inline)]
Noam Postavsky <npostavs <at> gmail.com> writes:

> So perhaps the best solution is simply rename epa-pinentry-mode to
> epg-pinentry-mode, and use it is as the default
> epg-context-pinentry-mode value (see attached).

Here's a more complete patch.  I will push to master in a few days.

[v2-0001-Move-epa-pinentry-mode-to-epg-config-Bug-26298.patch (text/x-diff, inline)]
From 034448c4d8e1adf85ef599e8612cdb1386433b09 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Sun, 29 Apr 2018 10:32:03 -0400
Subject: [PATCH v2] Move epa-pinentry-mode to epg-config (Bug#26298)

* lisp/epa.el (epa-pinentry-mode): Make into obsolete alias for...
* lisp/epg-config.el (epg-pinentry-mode): ...this new user option.
* lisp/epg.el (epg-context): Use it as the default value for
pinentry-mode.
* etc/NEWS: Announce name change.

* lisp/epa-file.el (epa-file-insert-file-contents)
(epa-file-write-region):
* lisp/epa.el(epa-decrypt-file, epa-sign-file)
(epa-encrypt-file, epa-decrypt-region)
(epa-sign-region, epa-encrypt-region): Don't change
epg-context-pinentry-mode from the default.
---
 etc/NEWS           |  3 +++
 lisp/epa-file.el   |  2 --
 lisp/epa.el        | 30 ++----------------------------
 lisp/epg-config.el | 22 ++++++++++++++++++++++
 lisp/epg.el        |  2 +-
 5 files changed, 28 insertions(+), 31 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index c7ffb17ad3..4a4c8f2de4 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -442,6 +442,9 @@ are formatted as MIME digests.
 *** 'message-forward-included-headers' has changed its default to
 exclude most headers when forwarding.
 
+** 'epa-pinentry-mode' is renamed to 'epg-pinentry-mode',
+It now applies to epg functions as well as epa functions.
+
 * New Modes and Packages in Emacs 27.1
 
 +++
diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index 1de2f9ba2d..866a4ae03a 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -147,7 +147,6 @@ epa-file-insert-file-contents
      context
      (cons #'epa-progress-callback-function
 	   (format "Decrypting %s" file)))
-    (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
     (unwind-protect
 	(progn
 	  (if replace
@@ -236,7 +235,6 @@ epa-file-write-region
      (cons #'epa-progress-callback-function
 	   (format "Encrypting %s" file)))
     (setf (epg-context-armor context) epa-armor)
-    (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
     (condition-case error
 	(setq string
 	      (epg-encrypt-string
diff --git a/lisp/epa.el b/lisp/epa.el
index a375cd6170..b9e7cbbb94 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -56,27 +56,8 @@ epa-info-window-height
   :type 'integer
   :group 'epa)
 
-;; In the doc string below, we say "symbol `error'" to avoid producing
-;; a hyperlink for `error' the function.
-(defcustom epa-pinentry-mode nil
-  "The pinentry mode.
-
-GnuPG 2.1 or later has an option to control the behavior of
-Pinentry invocation.  The value should be the symbol `error',
-`ask', `cancel', or `loopback'.  See the GnuPG manual for the
-meanings.
-
-In epa commands, a particularly useful mode is `loopback', which
-redirects all Pinentry queries to the caller, so Emacs can query
-passphrase through the minibuffer, instead of external Pinentry
-program."
-  :type '(choice (const nil)
-		 (const ask)
-		 (const cancel)
-		 (const error)
-		 (const loopback))
-  :group 'epa
-  :version "25.1")
+(define-obsolete-variable-alias
+  'epa-entry-mode 'epg-entry-mode "27.1")
 
 (defgroup epa-faces nil
   "Faces for epa-mode."
@@ -695,7 +676,6 @@ epa-decrypt-file
 					#'epa-progress-callback-function
 					(format "Decrypting %s..."
 						(file-name-nondirectory decrypt-file))))
-    (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
     (message "Decrypting %s..." (file-name-nondirectory decrypt-file))
     (condition-case error
 	(epg-decrypt-file context decrypt-file plain-file)
@@ -791,7 +771,6 @@ epa-sign-file
 					#'epa-progress-callback-function
 					(format "Signing %s..."
 						(file-name-nondirectory file))))
-    (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
     (message "Signing %s..." (file-name-nondirectory file))
     (condition-case error
 	(epg-sign-file context file signature mode)
@@ -822,7 +801,6 @@ epa-encrypt-file
 					#'epa-progress-callback-function
 					(format "Encrypting %s..."
 						(file-name-nondirectory file))))
-    (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
     (message "Encrypting %s..." (file-name-nondirectory file))
     (condition-case error
 	(epg-encrypt-file context file recipients cipher)
@@ -865,7 +843,6 @@ epa-decrypt-region
 					 (cons
 					  #'epa-progress-callback-function
 					  "Decrypting..."))
-      (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
       (message "Decrypting...")
       (condition-case error
 	  (setq plain (epg-decrypt-string context (buffer-substring start end)))
@@ -1070,7 +1047,6 @@ epa-sign-region
 					 (cons
 					  #'epa-progress-callback-function
 					  "Signing..."))
-      (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
       (message "Signing...")
       (condition-case error
 	  (setq signature (epg-sign-string context
@@ -1159,7 +1135,6 @@ epa-encrypt-region
 					 (cons
 					  #'epa-progress-callback-function
 					  "Encrypting..."))
-      (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
       (message "Encrypting...")
       (condition-case error
 	  (setq cipher (epg-encrypt-string context
@@ -1328,7 +1303,6 @@ epa-insert-keys
 ;; 	                                  (cons
 ;; 	                                    #'epa-progress-callback-function
 ;; 	                                    "Signing keys..."))
-;;     (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
 ;;     (message "Signing keys...")
 ;;     (epg-sign-keys context keys local)
 ;;     (message "Signing keys...done")))
diff --git a/lisp/epg-config.el b/lisp/epg-config.el
index d30ebea2d6..ea57adc12f 100644
--- a/lisp/epg-config.el
+++ b/lisp/epg-config.el
@@ -74,6 +74,28 @@ epg-passphrase-coding-system
   :group 'epg
   :type 'symbol)
 
+
+;; In the doc string below, we say "symbol `error'" to avoid producing
+;; a hyperlink for `error' the function.
+(defcustom epg-pinentry-mode nil
+  "The pinentry mode.
+
+GnuPG 2.1 or later has an option to control the behavior of
+Pinentry invocation.  The value should be the symbol `error',
+`ask', `cancel', or `loopback'.  See the GnuPG manual for the
+meanings.
+
+A particularly useful mode is `loopback', which redirects all
+Pinentry queries to the caller, so Emacs can query passphrase
+through the minibuffer, instead of external Pinentry program."
+  :type '(choice (const nil)
+		 (const ask)
+		 (const cancel)
+		 (const error)
+		 (const loopback))
+  :group 'epa
+  :version "27.1")
+
 (defcustom epg-debug nil
   "If non-nil, debug output goes to the \" *epg-debug*\" buffer.
 Note that the buffer name starts with a space."
diff --git a/lisp/epg.el b/lisp/epg.el
index e6b4af2b36..f79f2046de 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -207,7 +207,7 @@ 'epg-error
   output-file
   result
   operation
-  pinentry-mode
+  (pinentry-mode epg-pinentry-mode)
   (error-output "")
   error-buffer)
 
-- 
2.11.0


This bug report was last modified 7 years and 5 days ago.

Previous Next


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