unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: Daiki Ueno <ueno@gnu.org>
Cc: 23619@debbugs.gnu.org
Subject: bug#23619: Some epg tests fail
Date: Tue, 21 Feb 2017 21:05:51 -0500	[thread overview]
Message-ID: <87mvdfgetc.fsf@users.sourceforge.net> (raw)
In-Reply-To: <od14lznhljb.fsf-ueno@gnu.org> (Daiki Ueno's message of "Tue, 21 Feb 2017 11:43:04 +0100")

[-- Attachment #1: Type: text/plain, Size: 1108 bytes --]

Daiki Ueno <ueno@gnu.org> writes:

> npostavs@users.sourceforge.net writes:
>
>> Daiki Ueno <ueno@gnu.org> writes:
>>
>>> npostavs@users.sourceforge.net writes:
>>>
>>>> Although this doesn't solve the problem for gpg 2.0.
>>>
>>> For a proper fix, you might want to check how GPGME and its test suites
>>> do.
>>
>> I don't see anything to handle gpg 2.0, specifically.  They do disable
>> pinentry for versions below 2.1.  Maybe their tests don't work with 2.0
>> either?
>
> It sounds unlikely to me that they don't work with 2.0, because 2.0
> support has been there for a decade.
>
> If I understand correctly their tests use their own pinentry program for
> 2.0 and 2.1:
> https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gpgme.git;a=blob;f=tests/gpg/pinentry
> https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gpgme.git;a=blob;f=tests/gpg/Makefile.am;h=8e26a92f0c54ce3c76e63e223ce034dea11d6e71;hb=HEAD#l115
>
> If your goal is to make epg tests work with all gpg versions, this could
> be an option worth considering.

The patch below lets the tests succeed also without the loopback patch.
Should we have both?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 3097 bytes --]

From 822207cea1f6b65a19c665a96bcbe181ab47547c Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Tue, 21 Feb 2017 20:46:15 -0500
Subject: [PATCH v3] Fix epg-tests with dummy-pinentry program (Bug#23619)

* test/data/epg/dummy-pinentry: New file.
* test/lisp/epg-tests.el (with-epg-tests): Add it to gpg-agent.conf
when a passphrase is required.  Add debug declaration.  Set
GPG_AGENT_INFO non-destructively.
---
 test/data/epg/dummy-pinentry | 22 ++++++++++++++++++++++
 test/lisp/epg-tests.el       | 18 ++++++++++++------
 2 files changed, 34 insertions(+), 6 deletions(-)
 create mode 100755 test/data/epg/dummy-pinentry

diff --git a/test/data/epg/dummy-pinentry b/test/data/epg/dummy-pinentry
new file mode 100755
index 0000000000..2228dfb0c6
--- /dev/null
+++ b/test/data/epg/dummy-pinentry
@@ -0,0 +1,22 @@
+#! /bin/bash
+# Dummy pinentry
+#
+# Copyright 2008 g10 Code GmbH
+#
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# This file is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE.
+
+echo OK Your orders please
+
+while read cmd; do
+  case $cmd in
+    GETPIN) echo D test0123456789; echo OK;;
+    *) echo OK;;
+  esac
+done
diff --git a/test/lisp/epg-tests.el b/test/lisp/epg-tests.el
index ea2b62c358..c61527207f 100644
--- a/test/lisp/epg-tests.el
+++ b/test/lisp/epg-tests.el
@@ -52,8 +52,9 @@ epg-tests-passphrase-callback
 					require-secret-key)
 			    &rest body)
   "Set up temporary locations and variables for testing."
-  (declare (indent 1))
-  `(let ((epg-tests-home-directory (make-temp-file "epg-tests-homedir" t)))
+  (declare (indent 1) (debug (sexp body)))
+  `(let ((epg-tests-home-directory (make-temp-file "epg-tests-homedir" t))
+         (process-environment (cons "GPG_AGENT_INFO" process-environment)))
      (unwind-protect
 	 (let ((context (epg-make-context 'OpenPGP)))
            (setf (epg-context-program context)
@@ -63,11 +64,16 @@ epg-tests-passphrase-callback
                                   `'require-passphrase))))
 	   (setf (epg-context-home-directory context)
 		 epg-tests-home-directory)
-	   (setenv "GPG_AGENT_INFO")
 	   ,(if require-passphrase
-		`(epg-context-set-passphrase-callback
-		  context
-		  #'epg-tests-passphrase-callback))
+		`(with-temp-file (expand-file-name
+                                  "gpg-agent.conf" epg-tests-home-directory)
+                   (insert "pinentry-program "
+                           (expand-file-name "dummy-pinentry"
+                                             epg-tests-data-directory)
+                           "\n")
+                   (epg-context-set-passphrase-callback
+                    context
+                    #'epg-tests-passphrase-callback)))
 	   ,(if require-public-key
 		`(epg-import-keys-from-file
 		  context
-- 
2.11.1


  reply	other threads:[~2017-02-22  2:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25 17:01 bug#23619: Some epg tests fail Glenn Morris
2017-02-19 15:58 ` npostavs
2017-02-19 18:34   ` Daiki Ueno
2017-02-19 20:35     ` npostavs
2017-02-20  8:39       ` Daiki Ueno
2017-02-20 16:04         ` npostavs
2017-02-20 16:15           ` Daiki Ueno
2017-02-20 18:16             ` npostavs
2017-02-21 10:43               ` Daiki Ueno
2017-02-22  2:05                 ` npostavs [this message]
2017-02-24  9:25                   ` Daiki Ueno
2017-03-01  1:01                     ` npostavs
2017-03-01 23:47                       ` Glenn Morris
2017-03-02  0:17                         ` npostavs
2017-03-03 17:57                           ` Glenn Morris
2017-03-03 18:37                             ` Glenn Morris
2017-03-04  4:53                             ` npostavs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mvdfgetc.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=23619@debbugs.gnu.org \
    --cc=ueno@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).