[git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.2.5-43-g83529e1

by NIIBE Yutaka cvs at cvs.gnupg.org
Wed Apr 4 13:37:40 CEST 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, STABLE-BRANCH-2-2 has been updated
       via  83529e1bd14a6d39f2a8ecab9fb6aa4c1f344c73 (commit)
      from  cb1731c23cddfa524d3f51cfd82029bff853a073 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 83529e1bd14a6d39f2a8ecab9fb6aa4c1f344c73
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Wed Apr 4 20:27:08 2018 +0900

    tests: Fix no gpg-agent upon removal of GNUPGHOME.
    
    * tests/gpgscm/gnupg.scm (with-ephemeral-home-directory): Add
    teadown-fn.
    * tests/gpgsm/export.scm: Use -no-atexit version and stop-agent.
    * tests/openpgp/decrypt-session-key.scm: Likewise.
    * tests/openpgp/decrypt-unwrap-verify.scm: Likewise.
    * tests/openpgp/defs.scm (have-opt-always-trust): Likewise.
    (setup-environment-no-atexit): New.
    (start-agent): Support no use of atexit.
    * tests/gpgsm/gpgsm-defs.scm (setup-gpgsm-environment-no-atexit): New.
    * tests/migrations/common.scm (untar-armored): Follow the change
    of with-ephemeral-home-directory.
    
    --
    
    When gpg-agent detects homedir removal, it will automatically exit.
    Then, call of 'gpgconf --kill all' will fail.  So, stop-agent should
    be called before the removal of homedir.
    
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>

diff --git a/tests/gpgscm/gnupg.scm b/tests/gpgscm/gnupg.scm
index 5fcf9fd..77bf479 100644
--- a/tests/gpgscm/gnupg.scm
+++ b/tests/gpgscm/gnupg.scm
@@ -28,17 +28,22 @@
 
 ;; Evaluate a sequence of expressions with an ephemeral home
 ;; directory.
-(define-macro (with-ephemeral-home-directory setup-fn . expressions)
+(define-macro (with-ephemeral-home-directory setup-fn teardown-fn . expressions)
   (let ((original-home-directory (gensym))
 	(ephemeral-home-directory (gensym))
-	(setup (gensym)))
+	(setup (gensym))
+	(teardown (gensym)))
     `(let ((,original-home-directory (getenv "GNUPGHOME"))
 	   (,ephemeral-home-directory (mkdtemp))
-	   (,setup (delay (,setup-fn))))
+	   (,setup (delay (,setup-fn)))
+	   (,teardown (delay (,teardown-fn))))
        (finally (unlink-recursively ,ephemeral-home-directory)
 	 (dynamic-wind
 	     (lambda ()
 	       (setenv "GNUPGHOME" ,ephemeral-home-directory #t)
 	       (with-working-directory ,ephemeral-home-directory (force ,setup)))
 	     (lambda () , at expressions)
-	     (lambda () (setenv "GNUPGHOME" ,original-home-directory #t)))))))
+	     (lambda ()
+	       (setenv "GNUPGHOME" ,ephemeral-home-directory #t)
+	       (with-working-directory ,ephemeral-home-directory (force ,teardown))
+	       (setenv "GNUPGHOME" ,original-home-directory #t)))))))
diff --git a/tests/gpgsm/export.scm b/tests/gpgsm/export.scm
index d29b6cc..4a8108b 100644
--- a/tests/gpgsm/export.scm
+++ b/tests/gpgsm/export.scm
@@ -25,7 +25,7 @@
  (lambda (cert)
    (lettmp (exported)
      (call-check `(, at gpgsm --output ,exported --export ,cert::uid::CN))
-     (with-ephemeral-home-directory setup-gpgsm-environment
+     (with-ephemeral-home-directory setup-gpgsm-environment-no-atexit stop-agent
       (call-check `(, at gpgsm --import ,exported))
       (assert (sm-have-public-key? cert)))))
  (lambda (cert) cert::uid::CN)
diff --git a/tests/gpgsm/gpgsm-defs.scm b/tests/gpgsm/gpgsm-defs.scm
index c78a127..f118642 100644
--- a/tests/gpgsm/gpgsm-defs.scm
+++ b/tests/gpgsm/gpgsm-defs.scm
@@ -99,3 +99,9 @@
       (call-check `(,(tool 'gpgtar) --extract --directory=. ,(cadr *args*)))
       (create-gpgsm-gpghome))
   (start-agent))
+
+(define (setup-gpgsm-environment-no-atexit)
+  (if (member "--unpack-tarball" *args*)
+      (call-check `(,(tool 'gpgtar) --extract --directory=. ,(cadr *args*)))
+      (create-gpgsm-gpghome))
+  (start-agent #t))
diff --git a/tests/migrations/common.scm b/tests/migrations/common.scm
index 54d33b9..cabfdff 100644
--- a/tests/migrations/common.scm
+++ b/tests/migrations/common.scm
@@ -39,7 +39,7 @@
 (define GPGTAR (path-join (getenv "objdir") "tools" (qualify "gpgtar")))
 
 (define (untar-armored source-name)
-  (with-ephemeral-home-directory (lambda ())
+  (with-ephemeral-home-directory (lambda ()) (lambda ())
     (pipe:do
      (pipe:open source-name (logior O_RDONLY O_BINARY))
      (pipe:spawn `(, at GPG --dearmor))
diff --git a/tests/openpgp/decrypt-session-key.scm b/tests/openpgp/decrypt-session-key.scm
index 35aa7f3..c3294e0 100755
--- a/tests/openpgp/decrypt-session-key.scm
+++ b/tests/openpgp/decrypt-session-key.scm
@@ -37,7 +37,7 @@
  (lambda (name)
    (let* ((source (in-srcdir "tests" "openpgp" (string-append name ".asc")))
 	  (key (get-session-key source)))
-     (with-ephemeral-home-directory setup-environment
+     (with-ephemeral-home-directory setup-environment-no-atexit stop-agent
       (tr:do
        (tr:open source)
        (tr:gpg "" `(--yes --decrypt --override-session-key ,key))
diff --git a/tests/openpgp/decrypt-unwrap-verify.scm b/tests/openpgp/decrypt-unwrap-verify.scm
index bf7d14d..addc2da 100755
--- a/tests/openpgp/decrypt-unwrap-verify.scm
+++ b/tests/openpgp/decrypt-unwrap-verify.scm
@@ -35,7 +35,7 @@
 
        ;; Then, verify the signature with a clean working directory
        ;; containing only Steve's public key.
-       (with-ephemeral-home-directory setup-environment
+       (with-ephemeral-home-directory setup-environment-no-atexit stop-agent
 	(call-check `(, at gpg --import ,steve's-key))
 	(call-check `(, at gpg --verify ,unwrapped)))))
   '("encsig-2-keys-3" "encsig-2-keys-4")))
diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
index a6347fe..9537652 100644
--- a/tests/openpgp/defs.scm
+++ b/tests/openpgp/defs.scm
@@ -201,7 +201,7 @@
 
 (define have-opt-always-trust
   (catch #f
-	 (with-ephemeral-home-directory (lambda ())
+	 (with-ephemeral-home-directory (lambda ()) (lambda ())
 	   (call-check `(,(tool 'gpg) --gpgconf-test --always-trust)))
 	 #t))
 
@@ -365,6 +365,10 @@
   (create-gpghome)
   (start-agent))
 
+(define (setup-environment-no-atexit)
+  (create-gpghome)
+  (start-agent #t))
+
 (define (create-sample-files)
   (log "Creating sample data files")
   (for-each
@@ -448,12 +452,12 @@
   (preset-passphrases))
 
 ;; Create the socket dir and start the agent.
-(define (start-agent)
+(define (start-agent . args)
   (log "Starting gpg-agent...")
   (let ((gnupghome (getenv "GNUPGHOME")))
-    (atexit (lambda ()
-	      (with-home-directory gnupghome
-				   (stop-agent)))))
+    (if (null? args)
+	(atexit (lambda ()
+		  (with-home-directory gnupghome (stop-agent))))))
   (catch (log "Warning: Creating socket directory failed:" (car *error*))
 	 (gpg-conf '--create-socketdir))
   (call-check `(,(tool 'gpg-connect-agent) --verbose

-----------------------------------------------------------------------

Summary of changes:
 tests/gpgscm/gnupg.scm                  | 13 +++++++++----
 tests/gpgsm/export.scm                  |  2 +-
 tests/gpgsm/gpgsm-defs.scm              |  6 ++++++
 tests/migrations/common.scm             |  2 +-
 tests/openpgp/decrypt-session-key.scm   |  2 +-
 tests/openpgp/decrypt-unwrap-verify.scm |  2 +-
 tests/openpgp/defs.scm                  | 14 +++++++++-----
 7 files changed, 28 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list