emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-27 fa82365: Fix invocations of gpg from Gnus


From: Eli Zaretskii
Subject: emacs-27 fa82365: Fix invocations of gpg from Gnus
Date: Fri, 3 Apr 2020 07:31:08 -0400 (EDT)

branch: emacs-27
commit fa823653ffb0e3e893d30daa5abf68e909934e2e
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    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 74ab651..daa9a5a 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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]