GNU bug report logs - #23561
epg tests are (almost) always skipped

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Tue, 17 May 2016 06:30:02 UTC

Severity: minor

Tags: confirmed

Found in version 25.0.93

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #6 received at 23561 <at> debbugs.gnu.org (full text, mbox):

From: Daiki Ueno <ueno <at> gnu.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 23561 <at> debbugs.gnu.org
Subject: Re: bug#23561: epg tests are (almost) always skipped
Date: Tue, 17 May 2016 17:48:42 +0900
[Message part 1 (text/plain, inline)]
Glenn Morris <rgm <at> gnu.org> writes:

> Since f93d669a, epg-gpg-program defaults to gpg2 if present (which it is
> on most systems, I guess). epg-tests-gpg-usable, however, requires gpg
> version 1 (in the 'require-passphrase case, which is what every test in
> epg-tests uses). As a result, every test in epg-tests is skipped on a
> system with "gpg2" present (even if "gpg" is also present).

I am actually not sure how to cleanly solve this issue, but as long as
"gpg2" is GnuPG 2.0, the attached patch should work around the issue (if
"gpg2" is upgraded to 2.1, another issue will arise, though).

Regards,
-- 
Daiki Ueno
[0001-Adjust-to-epg-configuration-deprecation.patch (text/x-patch, inline)]
From d43d3e66b5582c1e5b8e61eaf7f3ac8866c997a4 Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno <at> gnu.org>
Date: Tue, 17 May 2016 17:46:31 +0900
Subject: [PATCH] Adjust to epg-configuration deprecation.

* test/lisp/epg-tests.el (epg-tests-gpg-usable): Use
`epg-find-configuration' instead of deprecated
`epg-configuration'.
---
 test/lisp/epg-tests.el | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/test/lisp/epg-tests.el b/test/lisp/epg-tests.el
index 4a31797..06e6f25 100644
--- a/test/lisp/epg-tests.el
+++ b/test/lisp/epg-tests.el
@@ -30,16 +30,20 @@ epg-tests-data-directory
   (expand-file-name "data/epg" (getenv "EMACS_TEST_DIRECTORY"))
   "Directory containing epg test data.")
 
+;; If a passphrase is required, we can only use GnuPG 1.x, as GnuPG
+;; 2.0 or later involves gpg-agent, which prevents injecting
+;; passphrase reliably.
 (defun epg-tests-gpg-usable (&optional require-passphrase)
-  (and (executable-find epg-gpg-program)
-       (condition-case nil
-	   (progn
-	     (epg-check-configuration (epg-configuration))
-	     (if require-passphrase
-		 (string-match "\\`1\\."
-			       (cdr (assq 'version (epg-configuration))))
-	       t))
-	 (error nil))))
+  (let ((config (epg-find-configuration 'OpenPGP)))
+    (and config
+         (condition-case nil
+             (progn
+               (epg-check-configuration config)
+               (if require-passphrase
+                   (string-match "\\`1\\."
+                                 (cdr (assq 'version config)))
+                 t))
+           (error nil)))))
 
 (defun epg-tests-passphrase-callback (_c _k _d)
   ;; Need to create a copy here, since the string will be wiped out
-- 
2.5.5


This bug report was last modified 6 years and 307 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.