diff options
| author | Eli Zaretskii | 2020-04-03 14:29:49 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2020-04-03 14:29:49 +0300 |
| commit | fa823653ffb0e3e893d30daa5abf68e909934e2e (patch) | |
| tree | 02ac6bb0a004b7bfde5f618417621c9465e97d8a | |
| parent | d4f51d0a2ef0dbba7a798cd7b8b0a791f723bda5 (diff) | |
| download | emacs-fa823653ffb0e3e893d30daa5abf68e909934e2e.tar.gz emacs-fa823653ffb0e3e893d30daa5abf68e909934e2e.zip | |
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.el | 16 |
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." | |||
| 183 | (defun epg-config--make-gpg-configuration (program) | 183 | (defun epg-config--make-gpg-configuration (program) |
| 184 | (let (config groups type args) | 184 | (let (config groups type args) |
| 185 | (with-temp-buffer | 185 | (with-temp-buffer |
| 186 | (apply #'call-process program nil (list t nil) nil | 186 | ;; The caller might have bound coding-system-for-* to something |
| 187 | (append (if epg-gpg-home-directory | 187 | ;; like 'no-conversion, but the below needs to call PROGRAM |
| 188 | (list "--homedir" epg-gpg-home-directory)) | 188 | ;; expecting human-readable text in both directions (since we |
| 189 | '("--with-colons" "--list-config"))) | 189 | ;; are going to parse the output as text), so let Emacs guess |
| 190 | ;; the encoding of that text by its usual encoding-detection | ||
| 191 | ;; machinery. | ||
| 192 | (let ((coding-system-for-read 'undecided) | ||
| 193 | (coding-system-for-write 'undecided)) | ||
| 194 | (apply #'call-process program nil (list t nil) nil | ||
| 195 | (append (if epg-gpg-home-directory | ||
| 196 | (list "--homedir" epg-gpg-home-directory)) | ||
| 197 | '("--with-colons" "--list-config")))) | ||
| 190 | (goto-char (point-min)) | 198 | (goto-char (point-min)) |
| 191 | (while (re-search-forward "^cfg:\\([^:]+\\):\\(.*\\)" nil t) | 199 | (while (re-search-forward "^cfg:\\([^:]+\\):\\(.*\\)" nil t) |
| 192 | (setq type (intern (match-string 1)) | 200 | (setq type (intern (match-string 1)) |