unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Leo Famulari <leo@famulari.name>
To: 24076@debbugs.gnu.org
Subject: bug#24076: [PATCH] gnu: GnuPG: Really use ~/.guix-profile/bin/pinentry by default.
Date: Fri, 27 Mar 2020 18:48:01 -0400	[thread overview]
Message-ID: <f71a360068e4dd9794c4f114361213e7569ff914.1585349180.git.leo@famulari.name> (raw)
In-Reply-To: <20160726180507.21e5e8e0@scratchpost.org>

This is a followup to commit c7af9d0b5ebaa1fdb08ff5d8a56004998bcd8103.

This patch does as expected for me! But it's been some years since I
wrote C code, so I copy existing functions and fought through compiler
errors to write this — please give a close review.

* gnu/packages/patches/gnupg-default-pinentry.patch: Use $HOME to find
the user's Guix profile and installed pinentry.
---
 .../patches/gnupg-default-pinentry.patch      | 39 +++++++++++++++----
 1 file changed, 32 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/patches/gnupg-default-pinentry.patch b/gnu/packages/patches/gnupg-default-pinentry.patch
index 272f4b53dc..5a3189b98a 100644
--- a/gnu/packages/patches/gnupg-default-pinentry.patch
+++ b/gnu/packages/patches/gnupg-default-pinentry.patch
@@ -1,15 +1,40 @@
-Default to the pinentry program installed in ~/.guix-profile.
-
 diff --git a/common/homedir.c b/common/homedir.c
-index e9e75d0..74e0aaf 100644
+index 4b6e46e88..de71e97b1 100644
 --- a/common/homedir.c
 +++ b/common/homedir.c
-@@ -968,7 +968,7 @@ get_default_pinentry_name (int reset)
+@@ -67,6 +67,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 +513,16 @@ 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 (!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 +985,7 @@ get_default_pinentry_name (int reset)
    } names[] = {
      /* The first entry is what we return in case we found no
         other pinentry.  */
--    { gnupg_bindir, DIRSEP_S "pinentry" EXEEXT_S },
-+    { gnupg_homedir, "/.guix-profile/bin/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.) */
-     { w32_rootdir, "\\..\\Gpg4win\\bin\\pinentry.exe" },
-- 
2.26.0

  parent reply	other threads:[~2020-03-27 22:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-26 16:05 bug#24076: gnupg [-agent]: when signing [commits], it claims that there is no pinentry - but there is Danny Milosavljevic
2016-07-26 20:30 ` Ludovic Courtès
2016-07-27  9:54   ` Danny Milosavljevic
2016-07-27 11:01     ` Ludovic Courtès
2016-07-28  9:56       ` Alex Kost
2016-07-28 11:52         ` Ludovic Courtès
2016-07-28 12:04           ` Danny Milosavljevic
2016-07-28 17:58             ` Alex Kost
2020-03-26 12:09           ` Ludovic Courtès
2020-03-27 20:02             ` Leo Famulari
2016-10-14  6:45 ` Federico Beffa
2016-10-14 13:16   ` Ludovic Courtès
2019-07-22 11:44 ` Robert Vollmert
2020-03-27 22:48 ` Leo Famulari [this message]
2020-03-29 14:57   ` bug#24076: [PATCH] gnu: GnuPG: Really use ~/.guix-profile/bin/pinentry by default Ludovic Courtès
2020-03-29 19:27     ` Leo Famulari
2021-04-22 21:49 ` bug#24076: gnupg [-agent]: when signing [commits], it claims that there is no pinentry - but there is Alexandre Hannud Abdo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f71a360068e4dd9794c4f114361213e7569ff914.1585349180.git.leo@famulari.name \
    --to=leo@famulari.name \
    --cc=24076@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).