From fa823653ffb0e3e893d30daa5abf68e909934e2e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 3 Apr 2020 14:29:49 +0300 Subject: [PATCH] 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) --- lisp/epg-config.el | 16 ++++++++++++---- 1 file 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)) -- 2.39.5