[git] GnuPG - branch, master, updated. gnupg-2.1.15-342-g1062953

by Justus Winter cvs at cvs.gnupg.org
Tue Nov 8 16:18:38 CET 2016


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, master has been updated
       via  1062953d5132af674aacfc6372e3e9f066c5d145 (commit)
       via  2a7615c48ed79e6b28710cc293ce30c812b2e5b0 (commit)
       via  4dd4801bfa4c3f7ba279b3d171a8ed299dbffaaa (commit)
       via  591d61d80f4f81176f7e236df794922df9e001a1 (commit)
       via  d4454837cd60981c2863955b11c9e1cc8f9e3833 (commit)
       via  dd13b2a561e31045fd3d3576bab99543cd4eb6cc (commit)
       via  7cbb0803847b8db618d39ff50ae6015e409ab1ae (commit)
      from  26df829fa22f027ca4a5eaf155cdaa2123afbdd5 (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 1062953d5132af674aacfc6372e3e9f066c5d145
Author: Justus Winter <justus at g10code.com>
Date:   Tue Nov 8 16:15:32 2016 +0100

    tests: Fix environment setup.
    
    * tests/openpgp/defs.scm (setup-legacy-environment): Do not call
    'setup-environment' because that will start the agent, and hence
    register the atexit function twice.
    
    Fixes: a55393cb5f4b331cb3a715c7d9a8b91f7606f337
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
index 09c313b..e91902c 100644
--- a/tests/openpgp/defs.scm
+++ b/tests/openpgp/defs.scm
@@ -256,13 +256,12 @@
 ;; Initialize the test environment, install appropriate configuration
 ;; and start the agent, with the keys from the legacy test suite.
 (define (setup-legacy-environment)
-  (setup-environment)
+  (create-gpghome)
   (if (member "--unpack-tarball" *args*)
       (begin
 	(call-check `(,(tool 'gpgtar) --extract --directory=. ,(cadr *args*)))
 	(start-agent))
       (begin
-	(create-gpghome)
 	(start-agent)
 	(create-legacy-gpghome)))
   (preset-passphrases))

commit 2a7615c48ed79e6b28710cc293ce30c812b2e5b0
Author: Justus Winter <justus at g10code.com>
Date:   Tue Nov 8 15:54:56 2016 +0100

    tests: Log and display output from tests when run in parallel.
    
    * tests/openpgp/run-tests.scm (test): Add field 'logfd'.
    (test::new, test::set-*): Adapt accordingly.
    (test::set-logfd): New function.
    (test::open-log-file): Likewise.
    (test::run-sync): Use the new function.
    (test::run-async): Likewise.
    (test::report): Replay the log.
    (run-tests-parallel): Reverse the results to restore the original
    order.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/openpgp/run-tests.scm b/tests/openpgp/run-tests.scm
index 23ff8a2..90879a6 100644
--- a/tests/openpgp/run-tests.scm
+++ b/tests/openpgp/run-tests.scm
@@ -73,18 +73,23 @@
   (package
    (define (scm name . args)
      (new name #f `(,*argv0* ,@(verbosity (*verbose*)) , at args
-			     ,(in-srcdir name)) #f #f))
-   (define (new name directory command pid retcode)
+			     ,(in-srcdir name)) #f #f CLOSED_FD))
+   (define (new name directory command pid retcode logfd)
      (package
       (define (set-directory x)
-	(new name x command pid retcode))
+	(new name x command pid retcode logfd))
       (define (set-retcode x)
-	(new name directory command pid x))
+	(new name directory command pid x logfd))
       (define (set-pid x)
-	(new name directory command x retcode))
+	(new name directory command x retcode logfd))
+      (define (set-logfd x)
+	(new name directory command pid retcode x))
+      (define (open-log-file)
+	(let ((filename (string-append name ".log")))
+	  (catch '() (unlink filename))
+	  (open filename (logior O_RDWR O_BINARY O_CREAT) #o600)))
       (define (run-sync . args)
-	(letfd ((log (open (string-append name ".log")
-			   (logior O_WRONLY O_BINARY O_CREAT) #o600)))
+	(letfd ((log (open-log-file)))
 	  (with-working-directory directory
 	    (let* ((p (inbound-pipe))
 		   (pid (spawn-process-fd (append command args) 0
@@ -102,13 +107,19 @@
 	    name (spawn-process-fd (append command args)
 				   CLOSED_FD CLOSED_FD CLOSED_FD) #t))))
       (define (run-async . args)
-	(with-working-directory directory
-	  (set-pid (spawn-process-fd (append command args)
-				     CLOSED_FD CLOSED_FD CLOSED_FD))))
+	(let ((log (open-log-file)))
+	  (with-working-directory directory
+	    (new name directory command
+		 (spawn-process-fd (append command args) CLOSED_FD log log)
+		 retcode log))))
       (define (status)
 	(let ((t (assoc retcode '((0 "PASS") (77 "SKIP") (99 "ERROR")))))
 	  (if (not t) "FAIL" (cadr t))))
       (define (report)
+	(unless (= logfd CLOSED_FD)
+		(seek logfd 0 SEEK_SET)
+		(splice logfd STDERR_FILENO)
+		(close logfd))
 	(echo (string-append (status retcode) ":") name))))))
 
 (define (run-tests-parallel setup tests)
@@ -120,7 +131,7 @@
 	    (for-each (lambda (t)
 			(catch (echo "Removing" t::directory "failed:" *error*)
 			       (unlink-recursively t::directory))
-			(t::report)) results::procs)
+			(t::report)) (reverse results::procs))
 	    (exit (results::report)))
 	  (let* ((wd (mkdtemp))
 		 (test (car tests'))

commit 4dd4801bfa4c3f7ba279b3d171a8ed299dbffaaa
Author: Justus Winter <justus at g10code.com>
Date:   Tue Nov 8 15:38:17 2016 +0100

    tests: Simplify test.
    
    * tests/openpgp/issue2417.scm: Simplify.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/openpgp/issue2417.scm b/tests/openpgp/issue2417.scm
index 5f70e08..f584000 100755
--- a/tests/openpgp/issue2417.scm
+++ b/tests/openpgp/issue2417.scm
@@ -18,27 +18,15 @@
 ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
 
 (load (with-path "defs.scm"))
-(setup-legacy-environment)
+(setup-environment)
 
-(define old-home (getenv "GNUPGHOME"))
+(define keyfile (in-srcdir "samplekeys" "rsa-rsa-sample-1.asc"))
 
 (define (touch file-name)
   (close (open file-name (logior O_WRONLY O_BINARY O_CREAT) #o600)))
 
 (info "Checking robustness wrt empty databases in gnupghome (issue2417)...")
-
-(lettmp
- ;; Prepare some random key to import later.
- (keyfile)
- (pipe:do
-  (pipe:gpg '(--export alpha))
-  (pipe:write-to keyfile (logior O_WRONLY O_BINARY O_CREAT) #o600))
-
- (with-temporary-working-directory
-  (file-copy (path-join old-home "gpg.conf") "gpg.conf")
-  (file-copy (path-join old-home "gpg-agent.conf") "gpg-agent.conf")
-  (setenv "GNUPGHOME" "." #t)
-  (touch "trustdb.gpg")
-  (touch "pubring.gpg")
-  (touch "pubring.kbx")
-  (call-check `(,(tool 'GPG) --import ,keyfile))))
+(touch "trustdb.gpg")
+(touch "pubring.gpg")
+(touch "pubring.kbx")
+(call-check `(,(tool 'GPG) --import ,keyfile))

commit 591d61d80f4f81176f7e236df794922df9e001a1
Author: Justus Winter <justus at g10code.com>
Date:   Tue Nov 8 15:11:12 2016 +0100

    gpgscm: Expose seek and associated constants.
    
    * tests/gpgscm/ffi.c (do_seek): New function.
    (ffi_init): Expose 'seek' and 'SEEK_{SET,CUR,END}'.
    * tests/gpgscm/lib.scm: Document the new function.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/gpgscm/ffi.c b/tests/gpgscm/ffi.c
index add82f7..c91d4aa 100644
--- a/tests/gpgscm/ffi.c
+++ b/tests/gpgscm/ffi.c
@@ -326,6 +326,21 @@ do_close (scheme *sc, pointer args)
 }
 
 static pointer
+do_seek (scheme *sc, pointer args)
+{
+  FFI_PROLOG ();
+  int fd;
+  off_t offset;
+  int whence;
+  FFI_ARG_OR_RETURN (sc, int, fd, number, args);
+  FFI_ARG_OR_RETURN (sc, off_t, offset, number, args);
+  FFI_ARG_OR_RETURN (sc, int, whence, number, args);
+  FFI_ARGS_DONE_OR_RETURN (sc, args);
+  FFI_RETURN_ERR (sc, lseek (fd, offset, whence) == (off_t) -1
+                  ? gpg_error_from_syserror () : 0);
+}
+
+static pointer
 do_mkdtemp (scheme *sc, pointer args)
 {
   FFI_PROLOG ();
@@ -1309,6 +1324,9 @@ ffi_init (scheme *sc, const char *argv0, const char *scriptname,
   ffi_define_constant (sc, STDIN_FILENO);
   ffi_define_constant (sc, STDOUT_FILENO);
   ffi_define_constant (sc, STDERR_FILENO);
+  ffi_define_constant (sc, SEEK_SET);
+  ffi_define_constant (sc, SEEK_CUR);
+  ffi_define_constant (sc, SEEK_END);
 
   ffi_define_function (sc, sleep);
   ffi_define_function (sc, usleep);
@@ -1320,6 +1338,7 @@ ffi_init (scheme *sc, const char *argv0, const char *scriptname,
   ffi_define_function (sc, open);
   ffi_define_function (sc, fdopen);
   ffi_define_function (sc, close);
+  ffi_define_function (sc, seek);
   ffi_define_function_name (sc, "_mkdtemp", mkdtemp);
   ffi_define_function (sc, unlink);
   ffi_define_function (sc, unlink_recursively);
diff --git a/tests/gpgscm/lib.scm b/tests/gpgscm/lib.scm
index 27779e2..4e19eae 100644
--- a/tests/gpgscm/lib.scm
+++ b/tests/gpgscm/lib.scm
@@ -204,6 +204,14 @@
 ;; Libc functions.
 ;;
 
+;; Change the read/write offset.
+(ffi-define (seek fd offset whence))
+
+;; Constants for WHENCE.
+(ffi-define SEEK_SET)
+(ffi-define SEEK_CUR)
+(ffi-define SEEK_END)
+
 ;; Get our process id.
 (ffi-define (getpid))
 

commit d4454837cd60981c2863955b11c9e1cc8f9e3833
Author: Justus Winter <justus at g10code.com>
Date:   Tue Nov 8 14:47:43 2016 +0100

    gpgscm: Fix error message.
    
    * tests/gpgscm/ffi.c (do_wait_processes): Fix and improve error
    messages.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/gpgscm/ffi.c b/tests/gpgscm/ffi.c
index d4bf3ef..add82f7 100644
--- a/tests/gpgscm/ffi.c
+++ b/tests/gpgscm/ffi.c
@@ -48,6 +48,20 @@
 #include "ffi.h"
 #include "ffi-private.h"
 
+/* For use in nice error messages.  */
+static const char *
+ordinal_suffix (int n)
+{
+  switch (n)
+    {
+    case 1: return "st";
+    case 2: return "nd";
+    case 3: return "rd";
+    default: return "th";
+    }
+  assert (! "reached");
+}
+
 

 
 int
@@ -827,17 +841,19 @@ do_wait_processes (scheme *sc, pointer args)
 
   err = ffi_list2argv (sc, list_names, &names, &count);
   if (err == gpg_error (GPG_ERR_INV_VALUE))
-    return ffi_sprintf (sc, "%luth element of first argument is "
+    return ffi_sprintf (sc, "%lu%s element of first argument is "
                         "neither string nor symbol",
-                        (unsigned long) count);
+                        (unsigned long) count,
+                        ordinal_suffix ((int) count));
   if (err)
     FFI_RETURN_ERR (sc, err);
 
   err = ffi_list2intv (sc, list_pids, (int **) &pids, &count);
   if (err == gpg_error (GPG_ERR_INV_VALUE))
-    return ffi_sprintf (sc, "%luth element of second argument is "
-                        "neither string nor symbol",
-                        (unsigned long) count);
+    return ffi_sprintf (sc, "%lu%s element of second argument is "
+                        "not a number",
+                        (unsigned long) count,
+                        ordinal_suffix ((int) count));
   if (err)
     FFI_RETURN_ERR (sc, err);
 
@@ -995,19 +1011,6 @@ do_file_equal (scheme *sc, pointer args)
   goto out;
 }
 
-static const char *
-ordinal_suffix (int n)
-{
-  switch (n)
-    {
-    case 1: return "st";
-    case 2: return "nd";
-    case 3: return "rd";
-    default: return "th";
-    }
-  assert (! "reached");
-}
-
 static pointer
 do_splice (scheme *sc, pointer args)
 {

commit dd13b2a561e31045fd3d3576bab99543cd4eb6cc
Author: Justus Winter <justus at g10code.com>
Date:   Tue Nov 8 14:11:23 2016 +0100

    tests,w32: Make cleanup more robust.
    
    * tests/openpgp/run-tests.scm (run-tests-parallel): Catch errors when
    removing the working directory.  On Windows this can fail if there is
    still a process using one of the files there.
    (run-tests-sequential): Likewise.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/openpgp/run-tests.scm b/tests/openpgp/run-tests.scm
index 9e9bc3d..23ff8a2 100644
--- a/tests/openpgp/run-tests.scm
+++ b/tests/openpgp/run-tests.scm
@@ -118,7 +118,8 @@
       (if (null? tests')
 	  (let ((results (pool::wait)))
 	    (for-each (lambda (t)
-			(unlink-recursively t::directory)
+			(catch (echo "Removing" t::directory "failed:" *error*)
+			       (unlink-recursively t::directory))
 			(t::report)) results::procs)
 	    (exit (results::report)))
 	  (let* ((wd (mkdtemp))
@@ -134,7 +135,8 @@
       (if (null? tests')
 	  (let ((results (pool::wait)))
 	    (for-each (lambda (t)
-			(unlink-recursively t::directory))
+			(catch (echo "Removing" t::directory "failed:" *error*)
+			       (unlink-recursively t::directory)))
 		      results::procs)
 	    (exit (results::report)))
 	  (let* ((wd (mkdtemp))

commit 7cbb0803847b8db618d39ff50ae6015e409ab1ae
Author: Justus Winter <justus at g10code.com>
Date:   Tue Nov 8 14:05:46 2016 +0100

    common,w32: Simplify locking.
    
    * common/asshelp.c (lock_spawning): Use the same code on Windows that
    we use on all other platforms.
    (unlock_spawning): Likewise.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/common/asshelp.c b/common/asshelp.c
index f8c3237..2cab310 100644
--- a/common/asshelp.c
+++ b/common/asshelp.c
@@ -267,48 +267,7 @@ static gpg_error_t
 lock_spawning (lock_spawn_t *lock, const char *homedir, const char *name,
                int verbose)
 {
-#ifdef HAVE_W32_SYSTEM
-  int waitrc;
-  int timeout = (!strcmp (name, "agent")
-                 ? SECS_TO_WAIT_FOR_AGENT
-                 : SECS_TO_WAIT_FOR_DIRMNGR);
-
-  (void)homedir; /* Not required. */
-
-  *lock = CreateMutexW
-    (NULL, FALSE,
-     !strcmp (name, "agent")?   L"spawn_"GNUPG_NAME"_agent_sentinel":
-     !strcmp (name, "dirmngr")? L"spawn_"GNUPG_NAME"_dirmngr_sentinel":
-     /*                    */   L"spawn_"GNUPG_NAME"_unknown_sentinel");
-  if (!*lock)
-    {
-      log_error ("failed to create the spawn_%s mutex: %s\n",
-                 name, w32_strerror (-1));
-      return gpg_error (GPG_ERR_GENERAL);
-    }
-
- retry:
-  waitrc = WaitForSingleObject (*lock, 1000);
-  if (waitrc == WAIT_OBJECT_0)
-    return 0;
-
-  if (waitrc == WAIT_TIMEOUT && timeout)
-    {
-      timeout--;
-      if (verbose)
-        log_info ("another process is trying to start the %s ... (%ds)\n",
-                  name, timeout);
-      goto retry;
-    }
-  if (waitrc == WAIT_TIMEOUT)
-    log_info ("error waiting for the spawn_%s mutex: timeout\n", name);
-  else
-    log_info ("error waiting for the spawn_%s mutex: (code=%d) %s\n",
-              name, waitrc, w32_strerror (-1));
-  return gpg_error (GPG_ERR_GENERAL);
-#else /*!HAVE_W32_SYSTEM*/
   char *fname;
-
   (void)verbose;
 
   *lock = NULL;
@@ -333,7 +292,6 @@ lock_spawning (lock_spawn_t *lock, const char *homedir, const char *name,
     return gpg_error_from_syserror ();
 
   return 0;
-#endif /*!HAVE_W32_SYSTEM*/
 }
 
 
@@ -343,15 +301,8 @@ unlock_spawning (lock_spawn_t *lock, const char *name)
 {
   if (*lock)
     {
-#ifdef HAVE_W32_SYSTEM
-      if (!ReleaseMutex (*lock))
-        log_error ("failed to release the spawn_%s mutex: %s\n",
-                   name, w32_strerror (-1));
-      CloseHandle (*lock);
-#else /*!HAVE_W32_SYSTEM*/
       (void)name;
       dotlock_destroy (*lock);
-#endif /*!HAVE_W32_SYSTEM*/
       *lock = NULL;
     }
 }

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

Summary of changes:
 common/asshelp.c            | 49 --------------------------------------
 tests/gpgscm/ffi.c          | 58 +++++++++++++++++++++++++++++++--------------
 tests/gpgscm/lib.scm        |  8 +++++++
 tests/openpgp/defs.scm      |  3 +--
 tests/openpgp/issue2417.scm | 24 +++++--------------
 tests/openpgp/run-tests.scm | 39 ++++++++++++++++++++----------
 6 files changed, 81 insertions(+), 100 deletions(-)


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




More information about the Gnupg-commits mailing list