GNUPGHOME and Win32

nnposter at users.sourceforge.net nnposter at users.sourceforge.net
Mon Oct 13 06:42:00 CEST 2003


I am respectfully proposing to change how Win32 port determines the GnuPG
home directory. Currently all ports except Win32 use the environment
variable GNUPGHOME while the Win32 port uses the registry. The attached
patch would modify this behavior so that the Win32 port also tries
variable GNUPGHOME first and then falls back on the registry key only if
the variable is not set.

This means that this change is fully backwards compatible unless somebody
is already using variable GNUPGHOME for other purposes.

The rationale behind this proposal is twofold: First, to unify this aspect
of GnuPG behavior across all ports, which helps with cross-platform
scripting, etc. The second reason is to allow Win32 platforms to run two
distinct instances of GnuPG under the same user context without having to
specify --homedir on every single command line for one of the instances.



--- g10.c       2003-07-30 09:24:20.000000000 -0600
+++ g10.c.new   2003-10-12 20:56:20.000000000 -0600
@@ -1120,11 +1120,11 @@
     opt.keyserver_options.include_subkeys=1;
     opt.keyserver_options.include_revoked=1;
     opt.mangle_dos_filenames = 1;
+    set_homedir ( getenv("GNUPGHOME") );
 #if defined (_WIN32)
+    if( !*opt.homedir )
         set_homedir ( read_w32_registry_string( NULL,
                                     "Software\\GNU\\GnuPG", "HomeDir" ));
-#else
-    set_homedir ( getenv("GNUPGHOME") );
 #endif
     if( !*opt.homedir )
        set_homedir ( GNUPG_HOMEDIR );



--- gpgv.c      2003-08-01 08:03:22.000000000 -0600
+++ gpgv.c.new  2003-10-12 21:21:28.000000000 -0600
@@ -163,11 +163,10 @@
     opt.keyserver_options.auto_key_retrieve = 1;
     opt.always_trust = 1;
     opt.batch = 1;
-
+    set_homedir ( getenv("GNUPGHOME") );
 #if defined (__MINGW32__)
+    if( !*opt.homedir )
     set_homedir (read_w32_registry_string( NULL, "Software\\GNU\\GnuPG", "HomeDir" ));
-#else
-    set_homedir (getenv("GNUPGHOME"));
 #endif
     if( !*opt.homedir ) {
       set_homedir (GNUPG_HOMEDIR);




More information about the Gnupg-devel mailing list