summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2020-04-03 14:29:49 +0300
committerEli Zaretskii <eliz@gnu.org>2020-04-03 14:29:49 +0300
commitfa823653ffb0e3e893d30daa5abf68e909934e2e (patch)
tree02ac6bb0a004b7bfde5f618417621c9465e97d8a
parentd4f51d0a2ef0dbba7a798cd7b8b0a791f723bda5 (diff)
downloademacs-fa823653ffb0e3e893d30daa5abf68e909934e2e.tar.gz
Fix invocations of gpg from Gnus
* lisp/epg-config.el (epg-config--make-gpg-configuration): Bind coding-system-for-read/write to 'undecided', to countermand possible values of 'no-conversion' or somesuch by the callers. (Bug#40248)
-rw-r--r--lisp/epg-config.el16
1 files changed, 12 insertions, 4 deletions
diff --git a/lisp/epg-config.el b/lisp/epg-config.el
index 74ab65113e7..daa9a5abd17 100644
--- a/lisp/epg-config.el
+++ b/lisp/epg-config.el
@@ -183,10 +183,18 @@ version requirement is met."
(defun epg-config--make-gpg-configuration (program)
(let (config groups type args)
(with-temp-buffer
- (apply #'call-process program nil (list t nil) nil
- (append (if epg-gpg-home-directory
- (list "--homedir" epg-gpg-home-directory))
- '("--with-colons" "--list-config")))
+ ;; The caller might have bound coding-system-for-* to something
+ ;; like 'no-conversion, but the below needs to call PROGRAM
+ ;; expecting human-readable text in both directions (since we
+ ;; are going to parse the output as text), so let Emacs guess
+ ;; the encoding of that text by its usual encoding-detection
+ ;; machinery.
+ (let ((coding-system-for-read 'undecided)
+ (coding-system-for-write 'undecided))
+ (apply #'call-process program nil (list t nil) nil
+ (append (if epg-gpg-home-directory
+ (list "--homedir" epg-gpg-home-directory))
+ '("--with-colons" "--list-config"))))
(goto-char (point-min))
(while (re-search-forward "^cfg:\\([^:]+\\):\\(.*\\)" nil t)
(setq type (intern (match-string 1))