unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob f9002d4d6c2b744c4e171743415db9a56cef7558 1850 bytes (raw)
name: gnu/packages/patches/gnupg-default-pinentry.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
 
Make GnuPG automatically find a pinentry installed by Guix. Try using
$HOME or, if that variable is not set, use the system password database,
or fall back to looking in "/".

More information:

https://bugs.gnu.org/24076

diff --git a/common/homedir.c b/common/homedir.c
index 4b6e46e88..f7ae68ba5 100644
--- a/common/homedir.c
+++ b/common/homedir.c
@@ -33,6 +33,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <pwd.h>
 
 #ifdef HAVE_W32_SYSTEM
 #include <winsock2.h>   /* Due to the stupid mingw64 requirement to
@@ -67,6 +68,10 @@
  * gnupg_homedir and gnupg_set_homedir.  Malloced.  */
 static char *the_gnupg_homedir;
 
+/* The user's home directory. Used in Guix to help GnuPG find the
+ * pinentry. */
+static char *the_user_homedir;
+
 /* Flag indicating that home directory is not the default one.  */
 static byte non_default_homedir;
 
@@ -509,6 +514,25 @@ gnupg_homedir (void)
   return the_gnupg_homedir;
 }
 
+/* Return the user's home directory */
+const char *
+user_homedir (void)
+{
+  const char *dir;
+  dir = getenv("HOME");
+  if (dir == NULL)
+    {
+       struct passwd *pw = NULL;
+       pw = getpwuid (getuid ());
+       if (pw != NULL)
+         dir = pw->pw_dir;
+       else
+         dir = "/";
+    }
+  if (!the_user_homedir)
+    the_user_homedir = make_absfilename (dir, NULL);
+  return the_user_homedir;
+}
 
 /* Return whether the home dir is the default one.  */
 int
@@ -971,6 +995,8 @@ get_default_pinentry_name (int reset)
   } names[] = {
     /* The first entry is what we return in case we found no
        other pinentry.  */
+    { user_homedir, "/.guix-profile/bin/pinentry" },
+    { user_homedir, "/.guix-home/profile/bin/pinentry" },
     { gnupg_bindir, DIRSEP_S "pinentry" EXEEXT_S },
 #ifdef HAVE_W32_SYSTEM
     /* Try Gpg4win directory (with bin and without.) */

debug log:

solving f9002d4d6c ...
found f9002d4d6c in https://yhetil.org/guix-patches/87plonftyv.fsf@denver.mail-host-address-is-not-set/
found a8ed613565 in https://git.savannah.gnu.org/cgit/guix.git
preparing index
index prepared:
100644 a8ed61356500ef22eef99ee3195543977547c034	gnu/packages/patches/gnupg-default-pinentry.patch

applying [1/1] https://yhetil.org/guix-patches/87plonftyv.fsf@denver.mail-host-address-is-not-set/
diff --git a/gnu/packages/patches/gnupg-default-pinentry.patch b/gnu/packages/patches/gnupg-default-pinentry.patch
index a8ed613565..f9002d4d6c 100644

Checking patch gnu/packages/patches/gnupg-default-pinentry.patch...
Applied patch gnu/packages/patches/gnupg-default-pinentry.patch cleanly.

index at:
100644 f9002d4d6c2b744c4e171743415db9a56cef7558	gnu/packages/patches/gnupg-default-pinentry.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).