[git] GPGME - branch, master, updated. gpgme-1.5.5-15-ga7dbab2

by Werner Koch cvs at cvs.gnupg.org
Mon Aug 24 20:02:51 CEST 2015


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 "GnuPG Made Easy".

The branch, master has been updated
       via  a7dbab23ea4976d106d649aa515ffb2968a085ed (commit)
       via  06d6fd8ca01354c8f7cfc847c4ac1b868268cbaa (commit)
       via  df098d6a437109c57516db75addf3764a6dfda81 (commit)
      from  2b632bbb78eee2b94c122f66d171a7c80e9c4fb0 (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 a7dbab23ea4976d106d649aa515ffb2968a085ed
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Aug 24 19:59:43 2015 +0200

    w32: Look for gpgconf in the new GnuPG 2.1 install dir.
    
    * src/w32-util.c (_gpgme_get_gpgconf_path): Try another location of
    gpgconf.exe.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/w32-util.c b/src/w32-util.c
index fa6dcdd..9aba26f 100644
--- a/src/w32-util.c
+++ b/src/w32-util.c
@@ -522,7 +522,16 @@ _gpgme_get_gpgconf_path (void)
       gpgconf = find_program_in_dir (inst_dir, name);
     }
 
-  /* 2. Try to find gpgconf.exe using that ancient registry key.  */
+  /* 2. Try to find gpgconf.exe from GnuPG >= 2.1 below CSIDL_PROGRAM_FILES. */
+  if (!gpgconf)
+    {
+      const char *name2 = (default_gpgconf_name ? default_gpgconf_name
+                           /**/                 : "GnuPG\\bin\\gpgconf.exe");
+      gpgconf = find_program_at_standard_place (name2);
+    }
+
+  /* 3. Try to find gpgconf.exe using that ancient registry key.  This
+        should eventually be removed.  */
   if (!gpgconf)
     {
       char *dir;
@@ -537,15 +546,13 @@ _gpgme_get_gpgconf_path (void)
         }
     }
 
-  /* 3. Try to find gpgconf.exe below CSIDL_PROGRAM_FILES.  */
+  /* 4. Try to find gpgconf.exe from Gpg4win below CSIDL_PROGRAM_FILES.  */
   if (!gpgconf)
     {
-      name = (default_gpgconf_name ? default_gpgconf_name
-              /**/                 : "GNU\\GnuPG\\gpgconf.exe");
-      gpgconf = find_program_at_standard_place (name);
+      gpgconf = find_program_at_standard_place ("GNU\\GnuPG\\gpgconf.exe");
     }
 
-  /* 4. Print a debug message if not found.  */
+  /* 5. Print a debug message if not found.  */
   if (!gpgconf)
     _gpgme_debug (DEBUG_ENGINE, "_gpgme_get_gpgconf_path: '%s' not found",name);
 

commit 06d6fd8ca01354c8f7cfc847c4ac1b868268cbaa
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Aug 24 16:34:29 2015 +0200

    w32: Expect gpgme-w32spawn.exe only in the gpgme installation dir.
    
    * src/w32-util.c (find_program_at_standard_place): Remove.
    (_gpgme_get_gpg_path): Make the search order more explicit.
    (_gpgme_get_gpgconf_path): Ditto.
    (_gpgme_get_w32spawn_path): Search only in the inst_dir.
    --
    
    This tries to avoid possible unclear bug reports by removing the
    fallback to the current gpg4win installation directory for the gpgme
    helper.  It is expected that users of gpgme installing their own gpgme
    version also install the matching helper.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/w32-util.c b/src/w32-util.c
index daf3bd2..fa6dcdd 100644
--- a/src/w32-util.c
+++ b/src/w32-util.c
@@ -398,40 +398,6 @@ find_program_in_dir (const char *dir, const char *name)
 
 
 static char *
-find_program_in_inst_dir (const char *inst_dir, const char *name)
-{
-  char *result;
-  char *dir;
-
-  /* If an installation directory has been passed, this overrides a
-     location given by the registry.  The idea here is that we prefer
-     a program installed alongside with gpgme.  We don't want the
-     registry to override this to have a better isolation of an gpgme
-     aware applications for other effects.  Note that the "Install
-     Directory" registry item has been used for ages in Gpg4win and
-     earlier GnuPG windows installers.  It is technically not anymore
-     required.  */
-  if (inst_dir)
-    {
-      result = find_program_in_dir (inst_dir, name);
-      if (result)
-        return result;
-    }
-
-  dir = read_w32_registry_string ("HKEY_LOCAL_MACHINE",
-				  "Software\\GNU\\GnuPG",
-				  "Install Directory");
-  if (dir)
-    {
-      result = find_program_in_dir (dir, name);
-      free (dir);
-      return result;
-    }
-  return NULL;
-}
-
-
-static char *
 find_program_at_standard_place (const char *name)
 {
   char path[MAX_PATH];
@@ -491,29 +457,50 @@ _gpgme_set_default_gpgconf_name (const char *name)
 
 
 /* Return the full file name of the GPG binary.  This function is used
-   if gpgconf was not found and thus it can be assumed that gpg2 is
+   iff gpgconf was not found and thus it can be assumed that gpg2 is
    not installed.  This function is only called by get_gpgconf_item
    and may not be called concurrently. */
 char *
 _gpgme_get_gpg_path (void)
 {
-  char *gpg;
-  const char *inst_dir, *name;
+  char *gpg = NULL;
+  const char *name, *inst_dir;
 
+  name = default_gpg_name? get_basename (default_gpg_name) : "gpg.exe";
+
+  /* 1. Try to find gpg.exe in the installation directory of gpgme.  */
   inst_dir = _gpgme_get_inst_dir ();
-  gpg = find_program_in_inst_dir
-    (inst_dir,
-     default_gpg_name? get_basename (default_gpg_name) : "gpg.exe");
+  if (inst_dir)
+    {
+      gpg = find_program_in_dir (inst_dir, name);
+    }
+
+  /* 2. Try to find gpg.exe using that ancient registry key.  */
   if (!gpg)
     {
-      name = (default_gpg_name? default_gpg_name
-              /* */           : "GNU\\GnuPG\\gpg.exe");
+      char *dir;
+
+      dir = read_w32_registry_string ("HKEY_LOCAL_MACHINE",
+                                      "Software\\GNU\\GnuPG",
+                                      "Install Directory");
+      if (dir)
+        {
+          gpg = find_program_in_dir (dir, name);
+          free (dir);
+        }
+    }
+
+  /* 3. Try to find gpg.exe below CSIDL_PROGRAM_FILES.  */
+  if (!gpg)
+    {
+      name = default_gpg_name? default_gpg_name : "GNU\\GnuPG\\gpg.exe";
       gpg = find_program_at_standard_place (name);
-      if (!gpg)
-        _gpgme_debug (DEBUG_ENGINE, "_gpgme_get_gpg_path: '%s' not found",
-                      name);
     }
 
+  /* 4. Print a debug message if not found.  */
+  if (!gpg)
+    _gpgme_debug (DEBUG_ENGINE, "_gpgme_get_gpg_path: '%s' not found", name);
+
   return gpg;
 }
 
@@ -523,22 +510,45 @@ _gpgme_get_gpg_path (void)
 char *
 _gpgme_get_gpgconf_path (void)
 {
-  char *gpgconf;
+  char *gpgconf = NULL;
   const char *inst_dir, *name;
 
+  name = default_gpgconf_name? get_basename(default_gpgconf_name):"gpgconf.exe";
+
+  /* 1. Try to find gpgconf.exe in the installation directory of gpgme.  */
   inst_dir = _gpgme_get_inst_dir ();
-  gpgconf = find_program_in_inst_dir
-    (inst_dir,
-     default_gpgconf_name? get_basename (default_gpgconf_name) : "gpgconf.exe");
+  if (inst_dir)
+    {
+      gpgconf = find_program_in_dir (inst_dir, name);
+    }
+
+  /* 2. Try to find gpgconf.exe using that ancient registry key.  */
   if (!gpgconf)
     {
-      name = (default_gpgconf_name? default_gpgconf_name
-              /* */               : "GNU\\GnuPG\\gpgconf.exe");
+      char *dir;
+
+      dir = read_w32_registry_string ("HKEY_LOCAL_MACHINE",
+                                      "Software\\GNU\\GnuPG",
+                                      "Install Directory");
+      if (dir)
+        {
+          gpgconf = find_program_in_dir (dir, name);
+          free (dir);
+        }
+    }
+
+  /* 3. Try to find gpgconf.exe below CSIDL_PROGRAM_FILES.  */
+  if (!gpgconf)
+    {
+      name = (default_gpgconf_name ? default_gpgconf_name
+              /**/                 : "GNU\\GnuPG\\gpgconf.exe");
       gpgconf = find_program_at_standard_place (name);
-      if (!gpgconf)
-        _gpgme_debug (DEBUG_ENGINE, "_gpgme_get_gpgconf_path: '%s' not found",
-                      name);
     }
+
+  /* 4. Print a debug message if not found.  */
+  if (!gpgconf)
+    _gpgme_debug (DEBUG_ENGINE, "_gpgme_get_gpgconf_path: '%s' not found",name);
+
   return gpgconf;
 }
 
@@ -552,10 +562,7 @@ _gpgme_get_w32spawn_path (void)
   inst_dir = _gpgme_get_inst_dir ();
   LOCK (get_path_lock);
   if (!w32spawn_program)
-    w32spawn_program = find_program_in_inst_dir (inst_dir,"gpgme-w32spawn.exe");
-  if (!w32spawn_program)
-    w32spawn_program
-      = find_program_at_standard_place ("GNU\\GnuPG\\gpgme-w32spawn.exe");
+    w32spawn_program = find_program_in_dir (inst_dir, "gpgme-w32spawn.exe");
   UNLOCK (get_path_lock);
   return w32spawn_program;
 }

commit df098d6a437109c57516db75addf3764a6dfda81
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Aug 24 15:03:20 2015 +0200

    w32: Print the installation directory in debug mode.
    
    * src/debug.c (debug_init) [W32]: Show libgpgme installation dir.
    --
    
    I expect that gpgme will be distributed by applications and thus it
    will be helpful to see in the debug log which gpgme is actually used.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/debug.c b/src/debug.c
index 292db55..1dd3723 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -46,6 +46,7 @@
 #include "util.h"
 #include "ath.h"
 #include "sema.h"
+#include "sys-util.h"
 #include "debug.h"
 
 

@@ -207,7 +208,16 @@ debug_init (void)
   UNLOCK (debug_lock);
 
   if (debug_level > 0)
-    _gpgme_debug (DEBUG_INIT, "gpgme_debug: level=%d\n", debug_level);
+    {
+      _gpgme_debug (DEBUG_INIT, "gpgme_debug: level=%d\n", debug_level);
+#ifdef HAVE_W32_SYSTEM
+      {
+        const char *name = _gpgme_get_inst_dir ();
+        _gpgme_debug (DEBUG_INIT, "gpgme_debug: gpgme='%s'\n",
+                      name? name: "?");
+      }
+#endif
+    }
 }
 
 
diff --git a/src/sys-util.h b/src/sys-util.h
index 7180fca..589634b 100644
--- a/src/sys-util.h
+++ b/src/sys-util.h
@@ -27,4 +27,8 @@ int _gpgme_set_default_gpgconf_name (const char *name);
 char *_gpgme_get_gpg_path (void);
 char *_gpgme_get_gpgconf_path (void);
 
+#ifdef HAVE_W32_SYSTEM
+const char *_gpgme_get_inst_dir (void);
+#endif
+
 #endif /* SYS_UTIL_H */

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

Summary of changes:
 src/debug.c    |  12 +++++-
 src/sys-util.h |   4 ++
 src/w32-util.c | 132 +++++++++++++++++++++++++++++++--------------------------
 3 files changed, 88 insertions(+), 60 deletions(-)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list