[git] GnuPG - branch, master, updated. gnupg-2.1.20-93-gd2f6798

by Justus Winter cvs at cvs.gnupg.org
Mon Apr 24 16:37:52 CEST 2017


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  d2f6798621d751cd6ae6f091c4a2af4569c5b8aa (commit)
       via  78547bfe8a885579438a17abadca02b62cce2844 (commit)
       via  06a177ceea529269a7404740c60416bd6a4567b1 (commit)
       via  9ae63b9caefdf3e925c5928667fcd9227132d27f (commit)
       via  4aab0e6ac7f2887a6f38f0cb95365dd7c30b4b18 (commit)
      from  ee715201ae784e840b6136393289e6dbd6f4c540 (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 d2f6798621d751cd6ae6f091c4a2af4569c5b8aa
Author: Justus Winter <justus at g10code.com>
Date:   Thu Apr 20 17:39:41 2017 +0200

    gpgscm: Refactor cell finalization.
    
    * tests/gpgscm/scheme.c (finalize_cell): Use switch, return whether
    the cell may be freed.
    (gc): Update callsite.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
index 38f2870..811c51f 100644
--- a/tests/gpgscm/scheme.c
+++ b/tests/gpgscm/scheme.c
@@ -402,7 +402,7 @@ static pointer _get_cell(scheme *sc, pointer a, pointer b);
 static pointer reserve_cells(scheme *sc, int n);
 static pointer get_consecutive_cells(scheme *sc, int n);
 static pointer find_consecutive_cells(scheme *sc, int n);
-static void finalize_cell(scheme *sc, pointer a);
+static int finalize_cell(scheme *sc, pointer a);
 static int count_consecutive_cells(pointer x, int needed);
 static pointer find_slot_in_env(scheme *sc, pointer env, pointer sym, int all);
 static pointer mk_number(scheme *sc, num n);
@@ -1723,15 +1723,16 @@ static void gc(scheme *sc, pointer a, pointer b) {
       if (is_mark(p)) {
     clrmark(p);
       } else {
-    /* reclaim cell */
-        if (typeflag(p) & T_FINALIZE) {
-          finalize_cell(sc, p);
-        }
-        ++sc->fcells;
-	typeflag(p) = 0;
-        car(p) = sc->NIL;
-        cdr(p) = sc->free_cell;
-        sc->free_cell = p;
+	/* reclaim cell */
+        if ((typeflag(p) & T_FINALIZE) == 0
+	    || finalize_cell(sc, p)) {
+	  /* Reclaim cell.  */
+	  ++sc->fcells;
+	  typeflag(p) = 0;
+	  car(p) = sc->NIL;
+	  cdr(p) = sc->free_cell;
+	  sc->free_cell = p;
+	}
       }
     }
   }
@@ -1748,10 +1749,17 @@ static void gc(scheme *sc, pointer a, pointer b) {
        sc->no_memory = 1;
 }
 
-static void finalize_cell(scheme *sc, pointer a) {
-  if(is_string(a)) {
+/* Finalize A.  Returns true if a can be added to the list of free
+ * cells.  */
+static int
+finalize_cell(scheme *sc, pointer a)
+{
+  switch (type(a)) {
+  case T_STRING:
     sc->free(strvalue(a));
-  } else if(is_port(a)) {
+    break;
+
+  case T_PORT:
     if(a->_object._port->kind&port_file
        && a->_object._port->rep.stdio.closeit) {
       port_close(sc,a,port_input|port_output);
@@ -1759,19 +1767,28 @@ static void finalize_cell(scheme *sc, pointer a) {
       sc->free(a->_object._port->rep.string.start);
     }
     sc->free(a->_object._port);
-  } else if(is_foreign_object(a)) {
+    break;
+
+  case T_FOREIGN_OBJECT:
     a->_object._foreign_object._vtable->finalize(sc, a->_object._foreign_object._data);
-  } else if (is_vector(a)) {
-    int i;
-    for (i = vector_size(vector_length(a)) - 1; i > 0; i--) {
-      pointer p = a + i;
-      typeflag(p) = 0;
-      car(p) = sc->NIL;
-      cdr(p) = sc->free_cell;
-      sc->free_cell = p;
-      sc->fcells += 1;
-    }
+    break;
+
+  case T_VECTOR:
+    do {
+      int i;
+      for (i = vector_size(vector_length(a)) - 1; i > 0; i--) {
+	pointer p = a + i;
+	typeflag(p) = 0;
+	car(p) = sc->NIL;
+	cdr(p) = sc->free_cell;
+	sc->free_cell = p;
+	sc->fcells += 1;
+      }
+      break;
+    } while (0);
   }
+
+  return 1;	/* Free cell.  */
 }
 
 #if SHOW_ERROR_LINE

commit 78547bfe8a885579438a17abadca02b62cce2844
Author: Justus Winter <justus at g10code.com>
Date:   Thu Apr 20 17:38:43 2017 +0200

    gpgscm: Tweak error message display.
    
    * tests/gpgscm/init.scm (throw'): If the first argument to the error
    is a string, display it as such.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/gpgscm/init.scm b/tests/gpgscm/init.scm
index 87d3c88..af38620 100644
--- a/tests/gpgscm/init.scm
+++ b/tests/gpgscm/init.scm
@@ -613,8 +613,13 @@
     (quit (cadr args)))
    (else
     (display message)
-    (if args (begin
-	      (display ": ")
+    (when (and args (not (null? args)))
+	  (display ": ")
+	  (if (string? (car args))
+	      (begin (display (car args))
+		     (unless (null? (cdr args))
+			     (newline)
+			     (write (cdr args))))
 	      (write args)))
     (newline)
     (vm-history-print history)

commit 06a177ceea529269a7404740c60416bd6a4567b1
Author: Justus Winter <justus at g10code.com>
Date:   Thu Apr 20 17:35:15 2017 +0200

    tests: Deduplicate and simplify code.
    
    * tests/gpgme/gpgme-defs.scm (create-file): Move...
    * tests/gpgsm/gpgsm-defs.scm (create-file): ... likewise...
    * tests/openpgp/defs.scm (create-file): Here.
    (create-gpghome): Use 'create-file'.
    * tests/openpgp/gpg-agent.conf.tmpl: Delete file.
    * tests/openpgp/gpg.conf.tmpl: Likewise.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/gpgme/gpgme-defs.scm b/tests/gpgme/gpgme-defs.scm
index 1e215b1..690d097 100644
--- a/tests/gpgme/gpgme-defs.scm
+++ b/tests/gpgme/gpgme-defs.scm
@@ -45,11 +45,6 @@
 ;; The tests expect the pinentry to return the passphrase "abc".
 (setenv "PINENTRY_USER_DATA" "abc" #t)
 
-(define (create-file name . lines)
-  (letfd ((fd (open name (logior O_WRONLY O_CREAT O_BINARY) #o600)))
-    (let ((port (fdopen fd "wb")))
-      (for-each (lambda (line) (display line port) (newline port)) lines))))
-
 (define (create-gpgmehome . path)
   ;; Support for various environments.
   (define mode
diff --git a/tests/gpgsm/gpgsm-defs.scm b/tests/gpgsm/gpgsm-defs.scm
index c978c32..711922a 100644
--- a/tests/gpgsm/gpgsm-defs.scm
+++ b/tests/gpgsm/gpgsm-defs.scm
@@ -61,12 +61,6 @@
 					 (equal? key::fpr (:fpr l))))
 			(gpgsm-with-colons `(--list-secret-keys ,key::fpr))))))
 
-(define (create-file name . lines)
-  (letfd ((fd (open name (logior O_WRONLY O_CREAT O_BINARY) #o600)))
-    (let ((port (fdopen fd "wb")))
-      (for-each (lambda (line) (display line port) (newline port))
-		lines))))
-
 (define (create-gpgsmhome)
   (create-file "gpgsm.conf"
 	       "disable-crl-checks"
diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
index 38d25d8..9e681bf 100644
--- a/tests/openpgp/defs.scm
+++ b/tests/openpgp/defs.scm
@@ -309,6 +309,12 @@
    (lambda (port)
      (display (make-random-string size) port))))
 
+(define (create-file name . lines)
+  (letfd ((fd (open name (logior O_WRONLY O_CREAT O_BINARY) #o600)))
+    (let ((port (fdopen fd "wb")))
+      (for-each (lambda (line) (display line port) (newline port))
+		lines))))
+
 (define (create-gpghome)
   (log "Creating test environment...")
 
@@ -316,21 +322,24 @@
   (make-test-data "random_seed" 600)
 
   (log "Creating configuration files")
-  (for-each
-   (lambda (name)
-     (file-copy (in-srcdir "tests" "openpgp" (string-append name ".tmpl")) name)
-     (let ((p (open-input-output-file name)))
-       (cond
-	((string=? "gpg.conf" name)
-	 (if have-opt-always-trust
-	     (display "no-auto-check-trustdb\n" p))
-	 (display (string-append "agent-program "
-				 (tool 'gpg-agent)
-				 "|--debug-quick-random\n") p)
-	 (display "allow-weak-digest-algos\n" p))
-	((string=? "gpg-agent.conf" name)
-	 (display (string-append "pinentry-program " PINENTRY "\n") p)))))
-   '("gpg.conf" "gpg-agent.conf")))
+  (create-file "gpg.conf"
+	       "no-greeting"
+	       "no-secmem-warning"
+	       "no-permission-warning"
+	       "batch"
+	       "allow-weak-digest-algos"
+	       (if have-opt-always-trust
+		   "no-auto-check-trustdb" "#no-auto-check-trustdb")
+	       (string-append "agent-program "
+			      (tool 'gpg-agent)
+			      "|--debug-quick-random\n")
+	       )
+  (create-file "gpg-agent.conf"
+	       "allow-preset-passphrase"
+	       "no-grab"
+	       "enable-ssh-support"
+	       (string-append "pinentry-program " (tool 'pinentry))
+	       ))
 
 ;; Initialize the test environment, install appropriate configuration
 ;; and start the agent, without any keys.
diff --git a/tests/openpgp/gpg-agent.conf.tmpl b/tests/openpgp/gpg-agent.conf.tmpl
deleted file mode 100644
index 3559150..0000000
--- a/tests/openpgp/gpg-agent.conf.tmpl
+++ /dev/null
@@ -1,3 +0,0 @@
-allow-preset-passphrase
-no-grab
-enable-ssh-support
diff --git a/tests/openpgp/gpg.conf.tmpl b/tests/openpgp/gpg.conf.tmpl
deleted file mode 100644
index 19f3180..0000000
--- a/tests/openpgp/gpg.conf.tmpl
+++ /dev/null
@@ -1,4 +0,0 @@
-no-greeting
-no-secmem-warning
-no-permission-warning
-batch

commit 9ae63b9caefdf3e925c5928667fcd9227132d27f
Author: Justus Winter <justus at g10code.com>
Date:   Thu Apr 20 17:32:25 2017 +0200

    gpgscm: Fix test.
    
    * tests/gpgscm/t-child.scm: Use 'string-length' on the string.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/gpgscm/t-child.scm b/tests/gpgscm/t-child.scm
index 93208f4..fd1dcc3 100644
--- a/tests/gpgscm/t-child.scm
+++ b/tests/gpgscm/t-child.scm
@@ -107,12 +107,12 @@
   (pipe:spawn `(,child stdout4096))
   (pipe:spawn `(,child cat)))
  (tr:call-with-content (lambda (c)
-			 (assert (= 4096 (length c))))))
+			 (assert (= 4096 (string-length c))))))
 (tr:do
  (tr:pipe-do
   (pipe:spawn `(,child stdout8192))
   (pipe:spawn `(,child cat)))
  (tr:call-with-content (lambda (c)
-			 (assert (= 8192 (length c))))))
+			 (assert (= 8192 (string-length c))))))
 
 (echo "All good.")

commit 4aab0e6ac7f2887a6f38f0cb95365dd7c30b4b18
Author: Justus Winter <justus at g10code.com>
Date:   Thu Apr 20 15:09:13 2017 +0200

    gpgscm: Improve syntax checking.
    
    * tests/gpgscm/scheme.c (opexe_0): Make sure closure arguments are
    symbols.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
index 11f6fcb..38f2870 100644
--- a/tests/gpgscm/scheme.c
+++ b/tests/gpgscm/scheme.c
@@ -3559,10 +3559,13 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) {
                     is_pair(x); x = cdr(x), y = cdr(y)) {
                     if (y == sc->NIL) {
                          Error_1(sc, "not enough arguments, missing:", x);
-                    } else {
+                    } else if (is_symbol(car(x))) {
                          new_slot_in_env(sc, car(x), car(y));
-                    }
+                    } else {
+			 Error_1(sc, "syntax error in closure: not a symbol", car(x));
+		    }
                }
+
                if (x == sc->NIL) {
                     if (y != sc->NIL) {
                       Error_0(sc, "too many arguments");

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

Summary of changes:
 tests/gpgme/gpgme-defs.scm        |  5 ---
 tests/gpgscm/init.scm             |  9 +++--
 tests/gpgscm/scheme.c             | 72 +++++++++++++++++++++++++--------------
 tests/gpgscm/t-child.scm          |  4 +--
 tests/gpgsm/gpgsm-defs.scm        |  6 ----
 tests/openpgp/defs.scm            | 39 +++++++++++++--------
 tests/openpgp/gpg-agent.conf.tmpl |  3 --
 tests/openpgp/gpg.conf.tmpl       |  4 ---
 8 files changed, 79 insertions(+), 63 deletions(-)
 delete mode 100644 tests/openpgp/gpg-agent.conf.tmpl
 delete mode 100644 tests/openpgp/gpg.conf.tmpl


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




More information about the Gnupg-commits mailing list