GNU bug report logs - #24076
gnupg [-agent]: when signing [commits], it claims that there is no pinentry - but there is

Previous Next

Package: guix;

Reported by: Danny Milosavljevic <dannym <at> scratchpost.org>

Date: Tue, 26 Jul 2016 16:06:02 UTC

Severity: important

Merged with 36784, 37266

Done: Leo Famulari <leo <at> famulari.name>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24076 in the body.
You can then email your comments to 24076 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#24076; Package guix. (Tue, 26 Jul 2016 16:06:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Danny Milosavljevic <dannym <at> scratchpost.org>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Tue, 26 Jul 2016 16:06:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: bug-guix <at> gnu.org
Subject: gnupg [-agent]: when signing [commits], it claims that there is no
 pinentry - but there is
Date: Tue, 26 Jul 2016 18:05:07 +0200
dannym <at> dayas ~/src/guix$ strace -f  git commit -S -m "x" gnu/packages/databases.scm 2>&1 |grep pinentry
[pid 32548] write(4, "OPTION allow-pinentry-notify", 28) = 28
[pid 32548] read(4, "ERR 67108949 No pinentry <GPG Ag"..., 1002) = 37
[pid 32548] write(2, "gpg: signing failed: No pinentry", 32gpg: signing failed: No pinentry) = 32
[pid 32548] write(2, "gpg: signing failed: No pinentry", 32gpg: signing failed: No pinentry) = 32

dannym <at> dayas ~$ which pinentry
/home/dannym/.guix-profile/bin/pinentry
dannym <at> dayas ~$ pinen<TAB>
pinentry         pinentry-curses  pinentry-gtk-2   pinentry-tty
dannym <at> dayas ~$ pinentry
OK Pleased to meet you





Information forwarded to bug-guix <at> gnu.org:
bug#24076; Package guix. (Tue, 26 Jul 2016 20:32:02 GMT) Full text and rfc822 format available.

Message #8 received at 24076 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: 24076 <at> debbugs.gnu.org
Subject: Re: bug#24076: gnupg [-agent]: when signing [commits],
 it claims that there is no pinentry - but there is
Date: Tue, 26 Jul 2016 22:30:46 +0200
Danny Milosavljevic <dannym <at> scratchpost.org> skribis:

> dannym <at> dayas ~/src/guix$ strace -f  git commit -S -m "x" gnu/packages/databases.scm 2>&1 |grep pinentry
> [pid 32548] write(4, "OPTION allow-pinentry-notify", 28) = 28
> [pid 32548] read(4, "ERR 67108949 No pinentry <GPG Ag"..., 1002) = 37
> [pid 32548] write(2, "gpg: signing failed: No pinentry", 32gpg: signing failed: No pinentry) = 32
> [pid 32548] write(2, "gpg: signing failed: No pinentry", 32gpg: signing failed: No pinentry) = 32
>
> dannym <at> dayas ~$ which pinentry
> /home/dannym/.guix-profile/bin/pinentry
> dannym <at> dayas ~$ pinen<TAB>
> pinentry         pinentry-curses  pinentry-gtk-2   pinentry-tty
> dannym <at> dayas ~$ pinentry
> OK Pleased to meet you

My ~/.gnupg/gpg-agent.conf file reads this:

--8<---------------cut here---------------start------------->8---
pinentry-program /home/ludo/.guix-profile/bin/pinentry-gtk-2
--8<---------------cut here---------------end--------------->8---

… and I have:

--8<---------------cut here---------------start------------->8---
$ guix package --list-installed=pinentry
pinentry	0.9.7	out	/gnu/store/2ngvzmsmjykaiv697ffnl7ajc3dm0rrh-pinentry-0.9.7
--8<---------------cut here---------------end--------------->8---

Could it be that you’re missing one of these?

HTH,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#24076; Package guix. (Wed, 27 Jul 2016 09:55:01 GMT) Full text and rfc822 format available.

Message #11 received at 24076 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 24076 <at> debbugs.gnu.org
Subject: Re: bug#24076: gnupg [-agent]: when signing [commits], it claims
 that there is no pinentry - but there is
Date: Wed, 27 Jul 2016 11:54:05 +0200
Hi Ludo,

> My ~/.gnupg/gpg-agent.conf file reads this:
> 
> --8<---------------cut here---------------start------------->8---
> pinentry-program /home/ludo/.guix-profile/bin/pinentry-gtk-2
> --8<---------------cut here---------------end--------------->8---

Yes, the file didn't exist. I created it and it works now.

I did install the pinentry package, though.

Do you think it would make sense to put this in the skeleton for new user accounts?

It wouldn't matter if it's were not installed then - then the user will get an error message and would install it (hopefully). But then it would work.




Information forwarded to bug-guix <at> gnu.org:
bug#24076; Package guix. (Wed, 27 Jul 2016 11:02:02 GMT) Full text and rfc822 format available.

Message #14 received at 24076 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: 24076 <at> debbugs.gnu.org
Subject: Re: bug#24076: gnupg [-agent]: when signing [commits],
 it claims that there is no pinentry - but there is
Date: Wed, 27 Jul 2016 13:01:15 +0200
Hi,

Danny Milosavljevic <dannym <at> scratchpost.org> skribis:

>> My ~/.gnupg/gpg-agent.conf file reads this:
>> 
>> --8<---------------cut here---------------start------------->8---
>> pinentry-program /home/ludo/.guix-profile/bin/pinentry-gtk-2
>> --8<---------------cut here---------------end--------------->8---
>
> Yes, the file didn't exist. I created it and it works now.

Great.

> I did install the pinentry package, though.
>
> Do you think it would make sense to put this in the skeleton for new user accounts?

Maybe.  Ideally, this would be addressed by GnuPG itself, which should
somehow make it easier to set it up, because there’s nothing
GuixSD-specific here AFAICS.  What do other distros do to help?

Thanks,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#24076; Package guix. (Thu, 28 Jul 2016 09:57:02 GMT) Full text and rfc822 format available.

Message #17 received at 24076 <at> debbugs.gnu.org (full text, mbox):

From: Alex Kost <alezost <at> gmail.com>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>, 24076 <at> debbugs.gnu.org
Subject: Re: bug#24076: gnupg [-agent]: when signing [commits],
 it claims that there is no pinentry - but there is
Date: Thu, 28 Jul 2016 12:56:53 +0300
Ludovic Courtès (2016-07-27 14:01 +0300) wrote:

> Hi,
>
> Danny Milosavljevic <dannym <at> scratchpost.org> skribis:
>
>>> My ~/.gnupg/gpg-agent.conf file reads this:
>>> 
>>> --8<---------------cut here---------------start------------->8---
>>> pinentry-program /home/ludo/.guix-profile/bin/pinentry-gtk-2
>>> --8<---------------cut here---------------end--------------->8---
>>
>> Yes, the file didn't exist. I created it and it works now.
>
> Great.
>
>> I did install the pinentry package, though.
>>
>> Do you think it would make sense to put this in the skeleton for new user accounts?
>
> Maybe.  Ideally, this would be addressed by GnuPG itself, which should
> somehow make it easier to set it up, because there’s nothing
> GuixSD-specific here AFAICS.  What do other distros do to help?

My guess: other distros do nothing, because GnuPG searches for
pinentries in a default bindir, I mean in a dir where gpg is placed
(/usr/bin or whatever).

IMO this is Guix-specific, as you have to run gpg-agent with
--pinentry-program option (or specify it in the "gpg-agent.conf" file).

-- 
Alex




Information forwarded to bug-guix <at> gnu.org:
bug#24076; Package guix. (Thu, 28 Jul 2016 11:53:02 GMT) Full text and rfc822 format available.

Message #20 received at 24076 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Alex Kost <alezost <at> gmail.com>
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>, 24076 <at> debbugs.gnu.org
Subject: Re: bug#24076: gnupg [-agent]: when signing [commits],
 it claims that there is no pinentry - but there is
Date: Thu, 28 Jul 2016 13:52:35 +0200
Alex Kost <alezost <at> gmail.com> skribis:

> Ludovic Courtès (2016-07-27 14:01 +0300) wrote:
>
>> Hi,
>>
>> Danny Milosavljevic <dannym <at> scratchpost.org> skribis:
>>
>>>> My ~/.gnupg/gpg-agent.conf file reads this:
>>>> 
>>>> --8<---------------cut here---------------start------------->8---
>>>> pinentry-program /home/ludo/.guix-profile/bin/pinentry-gtk-2
>>>> --8<---------------cut here---------------end--------------->8---
>>>
>>> Yes, the file didn't exist. I created it and it works now.
>>
>> Great.
>>
>>> I did install the pinentry package, though.
>>>
>>> Do you think it would make sense to put this in the skeleton for new user accounts?
>>
>> Maybe.  Ideally, this would be addressed by GnuPG itself, which should
>> somehow make it easier to set it up, because there’s nothing
>> GuixSD-specific here AFAICS.  What do other distros do to help?
>
> My guess: other distros do nothing, because GnuPG searches for
> pinentries in a default bindir, I mean in a dir where gpg is placed
> (/usr/bin or whatever).
>
> IMO this is Guix-specific, as you have to run gpg-agent with
> --pinentry-program option (or specify it in the "gpg-agent.conf" file).

Good point.

What about having GnuPG depend on pinentry-tty, and configuring it with:

  --with-pinentry-pgm=/path/to/pinentry-tty

?  That would at least provide a reasonable default.  The closure size
of GnuPG would increase from 220 to 243 MiB (+10%).

Most of the time, people will want to use pinentry-gtk though.

Another option would be to change ‘gnupg_module_name’, in homedir.c, from:

--8<---------------cut here---------------start------------->8---
    case GNUPG_MODULE_NAME_PINENTRY:
#ifdef GNUPG_DEFAULT_PINENTRY
      return GNUPG_DEFAULT_PINENTRY;
#else
      X(bindir, "pinentry");
#endif
--8<---------------cut here---------------end--------------->8---

to something like:

--8<---------------cut here---------------start------------->8---
    case GNUPG_MODULE_NAME_PINENTRY:
      X(homedir, ".guix-profile/bin/pinentry);
--8<---------------cut here---------------end--------------->8---

… in which case GnuPG would default to the user-installed pinentry, if
available.  Not perfect either, but closer to what other distros do.

Thoughts?

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#24076; Package guix. (Thu, 28 Jul 2016 12:05:01 GMT) Full text and rfc822 format available.

Message #23 received at 24076 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: Alex Kost <alezost <at> gmail.com>, 24076 <at> debbugs.gnu.org
Subject: Re: bug#24076: gnupg [-agent]: when signing [commits], it claims
 that there is no pinentry - but there is
Date: Thu, 28 Jul 2016 14:04:41 +0200
> Another option would be to change ‘gnupg_module_name’, in homedir.c, from:
> 
> --8<---------------cut here---------------start------------->8---
>     case GNUPG_MODULE_NAME_PINENTRY:
> #ifdef GNUPG_DEFAULT_PINENTRY
>       return GNUPG_DEFAULT_PINENTRY;
> #else
>       X(bindir, "pinentry");
> #endif
> --8<---------------cut here---------------end--------------->8---
> 
> to something like:
> 
> --8<---------------cut here---------------start------------->8---
>     case GNUPG_MODULE_NAME_PINENTRY:
>       X(homedir, ".guix-profile/bin/pinentry);
> --8<---------------cut here---------------end--------------->8---
> 
> … in which case GnuPG would default to the user-installed pinentry, if
> available.  Not perfect either, but closer to what other distros do.

I would like that, yes. It's not like the X(bindir, "pinentry") would ever work in GuixSD anyway - so no loss.




Information forwarded to bug-guix <at> gnu.org:
bug#24076; Package guix. (Thu, 28 Jul 2016 17:59:02 GMT) Full text and rfc822 format available.

Message #26 received at 24076 <at> debbugs.gnu.org (full text, mbox):

From: Alex Kost <alezost <at> gmail.com>
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 24076 <at> debbugs.gnu.org
Subject: Re: bug#24076: gnupg [-agent]: when signing [commits],
 it claims that there is no pinentry - but there is
Date: Thu, 28 Jul 2016 20:58:29 +0300
Danny Milosavljevic (2016-07-28 15:04 +0300) wrote:

>> Another option would be to change ‘gnupg_module_name’, in homedir.c, from:
>> 
>> --8<---------------cut here---------------start------------->8---
>>     case GNUPG_MODULE_NAME_PINENTRY:
>> #ifdef GNUPG_DEFAULT_PINENTRY
>>       return GNUPG_DEFAULT_PINENTRY;
>> #else
>>       X(bindir, "pinentry");
>> #endif
>> --8<---------------cut here---------------end--------------->8---
>> 
>> to something like:
>> 
>> --8<---------------cut here---------------start------------->8---
>>     case GNUPG_MODULE_NAME_PINENTRY:
>>       X(homedir, ".guix-profile/bin/pinentry);
>> --8<---------------cut here---------------end--------------->8---
>> 
>> … in which case GnuPG would default to the user-installed pinentry, if
>> available.  Not perfect either, but closer to what other distros do.
>
> I would like that, yes. It's not like the X(bindir, "pinentry") would
> ever work in GuixSD anyway - so no loss.

(Not only GuixSD, but Guix in general)

I agree, this would be better than the current situation.

-- 
Alex




Information forwarded to bug-guix <at> gnu.org:
bug#24076; Package guix. (Fri, 14 Oct 2016 06:46:01 GMT) Full text and rfc822 format available.

Message #29 received at 24076 <at> debbugs.gnu.org (full text, mbox):

From: Federico Beffa <beffa <at> ieee.org>
To: 24076 <at> debbugs.gnu.org
Subject: Re: bug#24076: gnupg [-agent]: when signing [commits], it claims that
 there is no pinentry - but there is
Date: Fri, 14 Oct 2016 08:45:28 +0200
Note that installing 'gnupg' doesn't automatically bring in
'pinentry'. For this reason installing 'gnupg' doesn't work out of the
box as a user would expect:

gpg: agent_genkey failed: No pinentry
Key generation failed: No pinentry


Fede




Information forwarded to bug-guix <at> gnu.org:
bug#24076; Package guix. (Fri, 14 Oct 2016 13:17:01 GMT) Full text and rfc822 format available.

Message #32 received at 24076 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Federico Beffa <beffa <at> ieee.org>
Cc: 24076 <at> debbugs.gnu.org
Subject: Re: bug#24076: gnupg [-agent]: when signing [commits],
 it claims that there is no pinentry - but there is
Date: Fri, 14 Oct 2016 15:16:52 +0200
Federico Beffa <beffa <at> ieee.org> skribis:

> Note that installing 'gnupg' doesn't automatically bring in
> 'pinentry'. For this reason installing 'gnupg' doesn't work out of the
> box as a user would expect:
>
> gpg: agent_genkey failed: No pinentry
> Key generation failed: No pinentry

I agree that this is a problem.  A fix that would work is the 2nd option
outlined at:

  https://lists.gnu.org/archive/html/bug-guix/2016-07/msg00092.html

Haven’t taken the time to look into it yet!

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#24076; Package guix. (Mon, 22 Jul 2019 11:46:02 GMT) Full text and rfc822 format available.

Message #35 received at 24076 <at> debbugs.gnu.org (full text, mbox):

From: Robert Vollmert <rob <at> vllmrt.net>
To: 24076 <at> debbugs.gnu.org
Subject: gnupg [-agent]: when signing [commits], it claims that there is no
 pinentry - but there is
Date: Mon, 22 Jul 2019 13:44:57 +0200
Just to note that this is still a problem. I just installed
gnupg (via guix install gnupg), and gpg --generate-keys fails
due to missing pinentry. I had to find this bug report to
work around this.





Severity set to 'important' from 'normal' Request was from Brice Waegeneire <brice <at> waegenei.re> to control <at> debbugs.gnu.org. (Fri, 20 Mar 2020 20:37:01 GMT) Full text and rfc822 format available.

Merged 24076 36784 37266. Request was from Brice Waegeneire <brice <at> waegenei.re> to control <at> debbugs.gnu.org. (Fri, 20 Mar 2020 20:37:01 GMT) Full text and rfc822 format available.

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Thu, 26 Mar 2020 12:10:01 GMT) Full text and rfc822 format available.

Notification sent to Danny Milosavljevic <dannym <at> scratchpost.org>:
bug acknowledged by developer. (Thu, 26 Mar 2020 12:10:01 GMT) Full text and rfc822 format available.

Message #44 received at 24076-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Alex Kost <alezost <at> gmail.com>
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>, 24076-done <at> debbugs.gnu.org
Subject: Re: bug#24076: gnupg [-agent]: when signing [commits],
 it claims that there is no pinentry - but there is
Date: Thu, 26 Mar 2020 13:09:40 +0100
Hi!

ludo <at> gnu.org (Ludovic Courtès) skribis:

> What about having GnuPG depend on pinentry-tty, and configuring it with:
>
>   --with-pinentry-pgm=/path/to/pinentry-tty
>
> ?  That would at least provide a reasonable default.  The closure size
> of GnuPG would increase from 220 to 243 MiB (+10%).
>
> Most of the time, people will want to use pinentry-gtk though.
>
> Another option would be to change ‘gnupg_module_name’, in homedir.c, from:
>
>     case GNUPG_MODULE_NAME_PINENTRY:
> #ifdef GNUPG_DEFAULT_PINENTRY
>       return GNUPG_DEFAULT_PINENTRY;
> #else
>       X(bindir, "pinentry");
> #endif
>
>
> to something like:
>
>     case GNUPG_MODULE_NAME_PINENTRY:
>       X(homedir, ".guix-profile/bin/pinentry);
>
> … in which case GnuPG would default to the user-installed pinentry, if
> available.  Not perfect either, but closer to what other distros do.

I (finally!) implemented this second option in commit
c7af9d0b5ebaa1fdb08ff5d8a56004998bcd8103.

I confirmed that it has the indented effect like this:

--8<---------------cut here---------------start------------->8---
ludo <at> ribbon ~/src/guix$ ./pre-inst-env guix environment --ad-hoc gnupg strace coreutils sed grep -C
ludo <at> ribbon ~/src/guix [env]$ strace -f -o ,,s -s 500 gpg --generate-key
gpg (GnuPG) 2.2.20; Copyright (C) 2020 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

gpg: directory '/home/ludo/.gnupg' created
gpg: keybox '/home/ludo/.gnupg/pubring.kbx' created
Note: Use "gpg --full-generate-key" for a full featured key generation dialog.

GnuPG needs to construct a user ID to identify your key.

Real name: Foo Bar
Email address: foo <at> example.org
You selected this USER-ID:
    "Foo Bar <foo <at> example.org>"

Change (N)ame, (E)mail, or (O)kay/(Q)uit? o
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: agent_genkey failed: No pinentry
Key generation failed: No pinentry

--8<---------------cut here---------------end--------------->8---

where the strace log shows:

  10    execve("/home/ludo/.gnupg/.guix-profile/bin/pinentry", ["pinentry"], 0x7f7aa80035e0 /* 14 vars */) = -1 ENOENT (No such file or directory)

So now one just needs to install one of the pinentry packages.

Thanks,
Ludo’.




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Thu, 26 Mar 2020 12:10:01 GMT) Full text and rfc822 format available.

Notification sent to Raghav Gururajan <raghavgururajan <at> disroot.org>:
bug acknowledged by developer. (Thu, 26 Mar 2020 12:10:02 GMT) Full text and rfc822 format available.

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Thu, 26 Mar 2020 12:10:02 GMT) Full text and rfc822 format available.

Notification sent to jon <at> dorsal.tk:
bug acknowledged by developer. (Thu, 26 Mar 2020 12:10:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#24076; Package guix. (Fri, 27 Mar 2020 20:45:01 GMT) Full text and rfc822 format available.

Message #57 received at 24076 <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: 24076 <at> debbugs.gnu.org
Cc: ludo <at> gnu.org
Subject: Re: bug#24076: gnupg [-agent]: when signing [commits], it claims
 that there is no pinentry - but there is
Date: Fri, 27 Mar 2020 16:02:26 -0400
On Thu, Mar 26, 2020 at 01:09:40PM +0100, Ludovic Courtès wrote:
> I (finally!) implemented this second option in commit
> c7af9d0b5ebaa1fdb08ff5d8a56004998bcd8103.

It still doesn't work for me :/

> I confirmed that it has the indented effect like this:
[...]
> where the strace log shows:
> 
>   10    execve("/home/ludo/.gnupg/.guix-profile/bin/pinentry", ["pinentry"], 0x7f7aa80035e0 /* 14 vars */) = -1 ENOENT (No such file or directory)

This path includes the ~/.gnupg directory, so users need to do `export
GNUPGHOME=$HOME` for the lookup to work.

Is it okay to make GnuPG do that automatically when building the path in
get_default_pinentry_name()?




Information forwarded to bug-guix <at> gnu.org:
bug#24076; Package guix. (Fri, 27 Mar 2020 22:49:02 GMT) Full text and rfc822 format available.

Message #60 received at 24076 <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: 24076 <at> debbugs.gnu.org
Subject: [PATCH] gnu: GnuPG: Really use ~/.guix-profile/bin/pinentry by
 default.
Date: Fri, 27 Mar 2020 18:48:01 -0400
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





Information forwarded to bug-guix <at> gnu.org:
bug#24076; Package guix. (Mon, 30 Mar 2020 02:36:24 GMT) Full text and rfc822 format available.

Message #63 received at 24076 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Leo Famulari <leo <at> famulari.name>
Cc: 24076 <at> debbugs.gnu.org
Subject: Re: bug#24076: [PATCH] gnu: GnuPG: Really use
 ~/.guix-profile/bin/pinentry by default.
Date: Sun, 29 Mar 2020 16:57:33 +0200
Hi Leo!

Leo Famulari <leo <at> famulari.name> skribis:

> 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.

Thanks for fixing it, and apologies for the mistake!

> ++/* Return the user's home directory */
> ++const char *
> ++user_homedir (void)
> ++{
> ++  const char *dir;
> ++  dir = getenv("HOME");

Here I’d add:

  if (dir == NULL)
    {
       struct password *pw;
       pw = getpwuid (getuid ());
       if (pw != NULL)
         dir = pw->pw_dir;
       else
         dir = "/";
    }

Otherwise LGTM!

Ludo’.




Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 30 Mar 2020 02:36:45 GMT) Full text and rfc822 format available.

Reply sent to Leo Famulari <leo <at> famulari.name>:
You have taken responsibility. (Mon, 30 Mar 2020 17:31:02 GMT) Full text and rfc822 format available.

Notification sent to Danny Milosavljevic <dannym <at> scratchpost.org>:
bug acknowledged by developer. (Mon, 30 Mar 2020 17:31:02 GMT) Full text and rfc822 format available.

Message #70 received at 24076-done <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 24076-done <at> debbugs.gnu.org
Subject: Re: bug#24076: [PATCH] gnu: GnuPG: Really use
 ~/.guix-profile/bin/pinentry by default.
Date: Sun, 29 Mar 2020 15:27:46 -0400
On Sun, Mar 29, 2020 at 04:57:33PM +0200, Ludovic Courtès wrote:
> Here I’d add:
> 
>   if (dir == NULL)
>     {
>        struct password *pw;
>        pw = getpwuid (getuid ());
>        if (pw != NULL)
>          dir = pw->pw_dir;
>        else
>          dir = "/";
>     }
> 
> Otherwise LGTM!

Thanks, good idea! Pushed as e5b44b06b3fb19c897fb3e430bd41941905e101f




Reply sent to Leo Famulari <leo <at> famulari.name>:
You have taken responsibility. (Mon, 30 Mar 2020 17:31:02 GMT) Full text and rfc822 format available.

Notification sent to Raghav Gururajan <raghavgururajan <at> disroot.org>:
bug acknowledged by developer. (Mon, 30 Mar 2020 17:31:02 GMT) Full text and rfc822 format available.

Reply sent to Leo Famulari <leo <at> famulari.name>:
You have taken responsibility. (Mon, 30 Mar 2020 17:31:02 GMT) Full text and rfc822 format available.

Notification sent to jon <at> dorsal.tk:
bug acknowledged by developer. (Mon, 30 Mar 2020 17:31:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 28 Apr 2020 11:24:06 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Alexandre Hannud Abdo <abdo <at> member.fsf.org> to control <at> debbugs.gnu.org. (Thu, 22 Apr 2021 21:45:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#24076; Package guix. (Thu, 22 Apr 2021 21:50:01 GMT) Full text and rfc822 format available.

Message #87 received at 24076 <at> debbugs.gnu.org (full text, mbox):

From: Alexandre Hannud Abdo <abdo <at> member.fsf.org>
To: 24076 <at> debbugs.gnu.org
Subject: gnupg [-agent]: when signing [commits], it claims that there is no
 pinentry - but there is
Date: Thu, 22 Apr 2021 23:49:10 +0200
[Message part 1 (text/plain, inline)]
Ni! For info, when installing Guix System with the gnome service,
pinentry is installed but it's in the system profile, so it still
doesn't work out of the box, and it's still not obvious that you need
to install it to solve the problem. Maybe the system pinentry could be
included? Cheers, ale .~´
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 21 May 2021 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 339 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.