bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#40248: 27.0.90; Failure open .authinfo.gpg from Gnus


From: Eli Zaretskii
Subject: bug#40248: 27.0.90; Failure open .authinfo.gpg from Gnus
Date: Sat, 28 Mar 2020 10:55:00 +0300

> From: Juan José García-Ripoll
>  <juanjose.garcia.ripoll@csic.es>
> Cc: 40248@debbugs.gnu.org
> Date: Fri, 27 Mar 2020 17:21:03 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> >> Date: Fri, 27 Mar 2020 11:18:43 +0300
> >> From: Eli Zaretskii <eliz@gnu.org>
> >> Cc: 40248@debbugs.gnu.org
> >
> > I understand you have some potentially useful backtraces which show
> > how epg-find-configuration is improperly called in this case.  If so,
> > please do provide any information about this you have.
> 
> epg-find-configuration is called via the backtrace below. I have edited
> some personal information and domain names. The call chain looks
> legit. The problems are in nnimap-open-connection-1 and upwards, where
> the read encoding is set to binary.

Thanks, that is very useful.  Does the patch below give good results,
both in your Gnus scenario and when epg-find-configuration is called
in other contexts you are aware of and use?

Lars, can you or someone of the Gnus team tell why
nnimap-open-connection-1 binds coding-system-for-* to 'binary?  I
don't understand the rationale, as the code which uses this connection
seems to expect ASCII text in response.  What am I missing?  (I tried
to find the change(s) which introduced those bindings, but that seems
to have been done when Gnus was maintained on a separate Git
repository, and the relevant commits aren't visible in the Emacs
repository.)

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 @@ epg-find-configuration
 (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]