[git] GnuPG - branch, master, updated. gnupg-2.2.2-75-g0cfdd3b

by Werner Koch cvs at cvs.gnupg.org
Wed Nov 15 15:36:59 CET 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  0cfdd3b57d592fb6baa7dafe8fde124e8a6c7798 (commit)
       via  8704304699bcbc1c10d0315ec7d25a1ae05c9905 (commit)
      from  d05e54ac4fadc66543ccca45bb90fea2bba49d14 (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 0cfdd3b57d592fb6baa7dafe8fde124e8a6c7798
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Nov 15 15:30:21 2017 +0100

    assuan: Fix exponential decay for first second.
    
    * common/asshelp.c (wait_for_sock): Round SECSLEFT.
    * dirmngr/dirmngr.c (main): Take care of --debug-wait also in dameon
    mode.
    * common/sysutils.c (gnupg_usleep) [HAVE_NANOSLEEP]: Fix nanosleep use.
    --
    
    Without the rounding we saw in verbose mose
    
     [...]to come up ... (5s)
     [...]to come up ... (4s)
    
    immediately without the expected one second delay.  Waiting for the
    next seconds did not work if nanosleep was used due to improper passed
    parameters in gnupg_usleep.
    
    Adding --debug-wait for dirmngr in daemon mode is required to test
    this change.
    
    GnuPG-bug-id: 3490
    Fixes-commit: 149041b0b917f4298239fe18b5ebd5ead71584a6
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/common/asshelp.c b/common/asshelp.c
index 542747a..b9c0cf4 100644
--- a/common/asshelp.c
+++ b/common/asshelp.c
@@ -337,7 +337,10 @@ wait_for_sock (int secs, int which, const char *sockname,
     {
       if (verbose)
         {
-          secsleft = (target_us - elapsed_us)/1000000;
+          secsleft = (target_us - elapsed_us + 999999)/1000000;
+          /* log_clock ("left=%d last=%d targ=%d elap=%d next=%d\n", */
+          /*            secsleft, lastalert, target_us, elapsed_us, */
+          /*            next_sleep_us); */
           if (secsleft < lastalert)
             {
               log_info (which == 1?
diff --git a/common/sysutils.c b/common/sysutils.c
index e90010c..55a7ee9 100644
--- a/common/sysutils.c
+++ b/common/sysutils.c
@@ -340,11 +340,10 @@ gnupg_usleep (unsigned int usecs)
       struct timespec req;
       struct timespec rem;
 
-      req.tv_sec = 0;
-      req.tv_nsec = usecs * 1000;
-
+      req.tv_sec  = usecs / 1000000;
+      req.tv_nsec = (usecs % 1000000) * 1000;
       while (nanosleep (&req, &rem) < 0 && errno == EINTR)
-        req = rem;
+          req = rem;
     }
 
 #else /*Standard Unix*/
diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
index 9cb0203..631256d 100644
--- a/dirmngr/dirmngr.c
+++ b/dirmngr/dirmngr.c
@@ -1193,6 +1193,14 @@ main (int argc, char **argv)
           current_logfile = xstrdup (logfile);
         }
 
+      if (debug_wait)
+        {
+          log_debug ("waiting for debugger - my pid is %u .....\n",
+                     (unsigned int)getpid());
+          gnupg_sleep (debug_wait);
+          log_debug ("... okay\n");
+        }
+
 #ifndef HAVE_W32_SYSTEM
       if (strchr (socket_name, ':'))
         {

commit 8704304699bcbc1c10d0315ec7d25a1ae05c9905
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Nov 15 14:46:14 2017 +0100

    common: Change log_clock to printf style.
    
    * common/logging.c (log_clock): Use do_logv.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/common/logging.c b/common/logging.c
index 82b21e2..9f04a69 100644
--- a/common/logging.c
+++ b/common/logging.c
@@ -1039,14 +1039,16 @@ log_printsexp () {}
 is found in sexputils.c
 */
 
-/* Print a microsecond timestamp followed by STRING.  */
+/* Print a microsecond timestamp followed by a FORMAT.  */
 void
-log_clock (const char *string)
+log_clock (const char *fmt, ...)
 {
 #if ENABLE_LOG_CLOCK
   static unsigned long long initial;
   struct timespec tv;
   unsigned long long now;
+  char clockbuf[50];
+  va_list arg_ptr;
 
   if (clock_gettime (CLOCK_REALTIME, &tv))
     {
@@ -1059,10 +1061,20 @@ log_clock (const char *string)
   if (!initial)
     initial = now;
 
-  log_debug ("[%6llu] %s", (now - initial)/1000, string);
+  snprintf (clockbuf, sizeof clockbuf, "[%6llu] ", (now - initial)/1000);
+  va_start (arg_ptr, fmt);
+  do_logv (GPGRT_LOG_DEBUG, 0, NULL, clockbuf, fmt, arg_ptr);
+  va_end (arg_ptr);
+
 #else /*!ENABLE_LOG_CLOCK*/
+
   /* You may need to link with -ltr to use the above code.  */
-  log_debug ("[not enabled by configure] %s", string);
+  va_list arg_ptr;
+
+  va_start (arg_ptr, fmt);
+  do_logv (GPGRT_LOG_DEBUG, 0, NULL, "[no clock] ", fmt, arg_ptr);
+  va_end (arg_ptr);
+
 #endif  /*!ENABLE_LOG_CLOCK*/
 }
 
diff --git a/common/logging.h b/common/logging.h
index e1bf56b..34843c7 100644
--- a/common/logging.h
+++ b/common/logging.h
@@ -109,7 +109,7 @@ void log_flush (void);
    by the hexdump and a final LF.  */
 void log_printhex (const char *text, const void *buffer, size_t length);
 
-void log_clock (const char *string);
+void log_clock (const char *fmt, ...) GPGRT_ATTR_PRINTF(1,2);
 
 
 #endif /*GNUPG_COMMON_LOGGING_H*/

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

Summary of changes:
 common/asshelp.c  |  5 ++++-
 common/logging.c  | 20 ++++++++++++++++----
 common/logging.h  |  2 +-
 common/sysutils.c |  7 +++----
 dirmngr/dirmngr.c |  8 ++++++++
 5 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