[git] GnuPG - branch, justus/scm-3, updated. gnupg-2.1.10-138-gbfe3933

by Justus Winter cvs at cvs.gnupg.org
Mon Jan 25 14:16:53 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, justus/scm-3 has been updated
       via  bfe3933a86a282a75cbe4486e1f9210a095ea732 (commit)
       via  710cff84417bc76c5368085e327be33552fe779a (commit)
      from  1a73bcbf12464d5c8d99111c28d3e4e8ec63b328 (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 bfe3933a86a282a75cbe4486e1f9210a095ea732
Author: Justus Winter <justus at g10code.com>
Date:   Mon Jan 25 14:12:45 2016 +0100

    Fix whitespace trimming

diff --git a/tests/gpgscm/lib.scm b/tests/gpgscm/lib.scm
index 2b897d1..f5119eb 100644
--- a/tests/gpgscm/lib.scm
+++ b/tests/gpgscm/lib.scm
@@ -65,9 +65,27 @@
 (define (string-split haystack delimiter)
   (string-splitn haystack delimiter -1))
 
-;; Drop whitespace.
-(define (filter-whitespace s)
-  (list->string (filter (lambda (c) (not (char=? #\newline c))) (string->list s))))
+;; Trim the prefix of S containing only characters that make PREDICATE
+;; true.  For example (string-ltrim char-whitespace? "  foo") =>
+;; "foo".
+(define (string-ltrim predicate s)
+  (let loop ((s' (string->list s)))
+    (if (predicate (car s'))
+	(loop (cdr s'))
+	(list->string s'))))
+
+;; Trim the suffix of S containing only characters that make PREDICATE
+;; true.
+(define (string-rtrim predicate s)
+  (let loop ((s' (reverse (string->list s))))
+    (if (predicate (car s'))
+	(loop (cdr s'))
+	(list->string (reverse s')))))
+
+;; Trim both the prefix and suffix of S containing only characters
+;; that make PREDICATE true.
+(define (string-trim predicate s)
+  (string-ltrim predicate (string-rtrim predicate s)))
 
 (define (echo . msg)
   (for-each (lambda (x) (display x) (display " ")) msg)
diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
index 60e4c2a..585ce76 100644
--- a/tests/openpgp/defs.scm
+++ b/tests/openpgp/defs.scm
@@ -76,7 +76,7 @@
   (let* ((config-string
 	  (call-popen `(,GPG --with-colons --list-config ,what) ""))
 	 (config (string-splitn
-		  (filter-whitespace config-string) #\: 2)))
+		  (string-rtrim char-whitespace? config-string) #\: 2)))
     (string-split (caddr config) #\;)))
 
 (define all-pubkey-algos (get-config "pubkeyname"))

commit 710cff84417bc76c5368085e327be33552fe779a
Author: Justus Winter <justus at g10code.com>
Date:   Mon Jan 25 14:10:54 2016 +0100

    Use gnupg_mkdtemp

diff --git a/tests/gpgscm/ffi.c b/tests/gpgscm/ffi.c
index 7048b55..f8d8b2a 100644
--- a/tests/gpgscm/ffi.c
+++ b/tests/gpgscm/ffi.c
@@ -278,9 +278,8 @@ do_close (scheme *sc, pointer args)
   SC_RETURN_ERR (sc, close (fd) == 0 ? 0 : gpg_error_from_syserror ());
 }
 
-/* XXX avoid mktemp.  */
 static pointer
-do_mktemp (scheme *sc, pointer args)
+do_mkdtemp (scheme *sc, pointer args)
 {
   SC_FFI_PROLOG ();
   char *template;
@@ -292,7 +291,7 @@ do_mktemp (scheme *sc, pointer args)
     SC_RETURN_ERR (sc, EINVAL);
   strncpy (buffer, template, sizeof buffer);
 
-  SC_RETURN_STRING (sc, mktemp (buffer));
+  SC_RETURN_STRING (sc, gnupg_mkdtemp (buffer));
 }
 
 static pointer
@@ -796,7 +795,7 @@ ffi_init (scheme *sc)
   define_function (sc, exit);
   define_function (sc, open);
   define_function (sc, close);
-  define_function (sc, mktemp);
+  define_function (sc, mkdtemp);
   define_function (sc, unlink);
   define_function (sc, getcwd);
   define_function (sc, mkdir);
diff --git a/tests/gpgscm/tests.scm b/tests/gpgscm/tests.scm
index ac3af8b..8bf78cb 100644
--- a/tests/gpgscm/tests.scm
+++ b/tests/gpgscm/tests.scm
@@ -174,8 +174,13 @@
 	       ,(if (= 1 (length (cadr form)))
 		    `(begin ,@(cddr form))
 		    `(lettmp ,(cdadr form) ,@(cddr form)))))
-	  (catch #t (unlink ,(caadr form)))
-	  ,result-sym)) (mktemp "gpgscm-XXXXXX"))))
+	  (catch #t
+	    (let* ((filename ,(caadr form))
+		   (len (string-length filename))
+		   (dirname (substring 0 (- len 2))))
+	      (unlink filename)
+	      (rmdir dirname)))
+	  ,result-sym)) (string-append (mkdtemp "gpgscm-XXXXXX") "/a"))))
 
 (define (check-execution source transformer)
   (lettmp (sink)

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

Summary of changes:
 tests/gpgscm/ffi.c     |  7 +++----
 tests/gpgscm/lib.scm   | 24 +++++++++++++++++++++---
 tests/gpgscm/tests.scm |  9 +++++++--
 tests/openpgp/defs.scm |  2 +-
 4 files changed, 32 insertions(+), 10 deletions(-)


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




More information about the Gnupg-commits mailing list