2.1.19 testing failures on the debian build daemons

Werner Koch wk at gnupg.org
Thu Mar 23 12:14:51 CET 2017


On Thu, 23 Mar 2017 08:10, wk at gnupg.org said:

> I mentioned it in some other mail: I would agree to try creating sub
> directories below /run/user/$UID/gnupg instead of relying on
> --create-socketdir.  In case we ever run into problems with that we can
> add a configure options to disable this auto-creation.

Below is such a patch.  


Salam-Shalom,

   Werner


From d6f8d35dce3375636164061a008cf8ecb72908f4 Mon Sep 17 00:00:00 2001
From: Werner Koch <wk at gnupg.org>
Date: Thu, 23 Mar 2017 09:38:19 +0100
Subject: [PATCH] common: Implicitly do a gpgconf --create-socketdir.

* common/homedir.c (_gnupg_socketdir_internal): Create the
sub-directory.
--

Although there is no auto cleanup (yet) this should be helpful.  Let's
see whether possibly leaving stale directories around is better than
running into trouble when --create-socketdir was not used.

Signed-off-by: Werner Koch <wk at gnupg.org>
---
 common/homedir.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/common/homedir.c b/common/homedir.c
index 3055a32..ee4438c 100644
--- a/common/homedir.c
+++ b/common/homedir.c
@@ -542,7 +542,7 @@ _gnupg_socketdir_internal (int skip_checks, unsigned *r_info)
 
   /* If a non default homedir is used, we check whether an
    * corresponding sub directory below the socket dir is available
-   * and use that.  We has the non default homedir to keep the new
+   * and use that.  We hash the non default homedir to keep the new
    * subdir short enough.  */
   if (non_default_homedir)
     {
@@ -566,16 +566,27 @@ _gnupg_socketdir_internal (int skip_checks, unsigned *r_info)
           goto leave;
         }
 
-      /* Stat that directory and check constraints.  Note that we
-       * do not auto create such a directory because we would not
-       * have a way to remove it.  Thus the directory needs to be
-       * pre-created.  The command
-       *    gpgconf --create-socketdir
-       * can be used tocreate that directory.  */
+      /* Stat that directory and check constraints.
+       * The command
+       *    gpgconf --remove-socketdir
+       * can be used to remove that directory.  */
       if (stat (name, &sb))
         {
           if (errno != ENOENT)
             *r_info |= 1; /* stat failed. */
+          else if (!skip_checks)
+            {
+              /* Try to create the directory and check again.  */
+              if (gnupg_mkdir (name, "-rwx"))
+                *r_info |= 16; /* mkdir failed.  */
+              else if (stat (prefix, &sb))
+                {
+                  if (errno != ENOENT)
+                    *r_info |= 1; /* stat failed. */
+                  else
+                    *r_info |= 64; /* Subdir does not exist.  */
+                }
+            }
           else
             *r_info |= 64; /* Subdir does not exist.  */
           if (!skip_checks)
-- 
2.8.1



-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: </pipermail/attachments/20170323/83fc823a/attachment.sig>


More information about the Gnupg-devel mailing list