guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: gnu: GnuPG: Really use ~/.guix-profile/bin/pinent


From: guix-commits
Subject: branch master updated: gnu: GnuPG: Really use ~/.guix-profile/bin/pinentry by default.
Date: Sun, 29 Mar 2020 15:26:40 -0400

This is an automated email from the git hooks/post-receive script.

lfam pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new e5b44b0  gnu: GnuPG: Really use ~/.guix-profile/bin/pinentry by 
default.
e5b44b0 is described below

commit e5b44b06b3fb19c897fb3e430bd41941905e101f
Author: Leo Famulari <address@hidden>
AuthorDate: Fri Mar 27 18:44:48 2020 -0400

    gnu: GnuPG: Really use ~/.guix-profile/bin/pinentry by default.
    
    Fixes <https://bugs.gnu.org/24076>.
    
    * gnu/packages/patches/gnupg-default-pinentry.patch: New file. Use $HOME to 
find
    the user's Guix profile and installed pinentry.
    * gnu/local.mk (dist_patch_DATA): Add the patch.
    * gnu/packages/gnupg.scm (gnupg)[source]: Use it.
---
 gnu/local.mk                                      |  1 +
 gnu/packages/gnupg.scm                            |  3 +-
 gnu/packages/patches/gnupg-default-pinentry.patch | 65 +++++++++++++++++++++++
 3 files changed, 68 insertions(+), 1 deletion(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index cb492cb..7d8145b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -973,6 +973,7 @@ dist_patch_DATA =                                           
\
   %D%/packages/patches/gmp-faulty-test.patch                   \
   %D%/packages/patches/gnome-shell-theme.patch                 \
   %D%/packages/patches/gnome-tweaks-search-paths.patch         \
+  %D%/packages/patches/gnupg-default-pinentry.patch            \
   %D%/packages/patches/gnutls-skip-trust-store-test.patch      \
   %D%/packages/patches/gobject-introspection-absolute-shlib-path.patch \
   %D%/packages/patches/gobject-introspection-cc.patch          \
diff --git a/gnu/packages/gnupg.scm b/gnu/packages/gnupg.scm
index 856c01a..04bb705 100644
--- a/gnu/packages/gnupg.scm
+++ b/gnu/packages/gnupg.scm
@@ -11,7 +11,7 @@
 ;;; Copyright © 2016 Christopher Baines <address@hidden>
 ;;; Copyright © 2016 Mike Gerwitz <address@hidden>
 ;;; Copyright © 2016 Troy Sankey <address@hidden>
-;;; Copyright © 2017 Leo Famulari <address@hidden>
+;;; Copyright © 2017, 2020 Leo Famulari <address@hidden>
 ;;; Copyright © 2017 Petter <address@hidden>
 ;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <address@hidden>
 ;;; Copyright © 2018, 2019 Marius Bakke <address@hidden>
@@ -252,6 +252,7 @@ compatible to GNU Pth.")
               (method url-fetch)
               (uri (string-append "mirror://gnupg/gnupg/gnupg-" version
                                   ".tar.bz2"))
+              (patches (search-patches "gnupg-default-pinentry.patch"))
               (sha256
                (base32
                 "0c6a4v9p6qzhsw1pfcwc459bxpc8hma0w9z8iqb9khvligack9q4"))))
diff --git a/gnu/packages/patches/gnupg-default-pinentry.patch 
b/gnu/packages/patches/gnupg-default-pinentry.patch
new file mode 100644
index 0000000..a8ed613
--- /dev/null
+++ b/gnu/packages/patches/gnupg-default-pinentry.patch
@@ -0,0 +1,65 @@
+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,7 @@ 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" },
+     { gnupg_bindir, DIRSEP_S "pinentry" EXEEXT_S },
+ #ifdef HAVE_W32_SYSTEM
+     /* Try Gpg4win directory (with bin and without.) */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]