Bug 1221234 - gpg-1 cannot locate gpg-agent-2.1
Summary: gpg-1 cannot locate gpg-agent-2.1
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: gnupg
Version: 23
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Brian Lane
QA Contact: Fedora Extras Quality Assurance
URL: https://bugs.gnupg.org/gnupg/issue1986
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-05-13 14:30 UTC by Petr Pisar
Modified: 2015-12-01 22:10 UTC (History)
4 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2015-12-01 22:10:15 UTC


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Bugzilla 1189666 None None None Never

Internal Trackers: 1189666

Description Petr Pisar 2015-05-13 14:30:35 UTC
After upgrading gnupg2 to 2.1, the gpg-agent stopped exporting GPG_AGENT_INFO variable. Therefore gpg (version 1.4.19) cannot finf the agent anymore and reports an error:

$ "gpg-agent" "--disable-scdaemon" "--allow-preset" "--daemon"
$ /usr/libexec/gpg-preset-passphrase -P passphrase --preset 8E136E6F34C0D4CD941A9DB749539D60EFEA4EAD
$ "gpg" "--batch" "--no-tty" "--armor" "--default-key" "49539D60EFEA4EAD" "--use-agent" "--detach-sign" test_file
gpg: gpg-agent is not available in this session
[...]

Adding proper --gpg-agent-info argument allows the gpg to work again. Installed packages:

# rpm -qf /usr/bin/gpg /usr/bin/gpg-agent 
gnupg-1.4.19-1.fc23.x86_64
gnupg2-2.1.3-1.fc23.x86_64

This is because of this code from g10/passphrase.c:

  if (opt.gpg_agent_info)
    infostr = xstrdup (opt.gpg_agent_info);
  else
    {
      infostr = getenv ( "GPG_AGENT_INFO" );
      if (!infostr || !*infostr)
        {
          if (!try)
            {
#ifdef ENABLE_NLS
              if (orig_codeset)
                bind_textdomain_codeset (PACKAGE, orig_codeset);
#endif /*ENABLE_NLS*/
              log_info (_("gpg-agent is not available in this session\n"));
              opt.use_agent = 0;
            }
          return NULL;
        }
      infostr = xstrdup ( infostr );
    }

Obviously, gpg requires GPG_AGENT_INFO environment variable or --gpg-agent-info argument.

I propose to add a fallback to "${GNUPGHOME}/S.gpg-agent::1" value which is now hard-coded by all gnupg-2 tools.

Comment 1 Brian Lane 2015-05-13 16:09:05 UTC
Please submit this suggestion upstream using the gpg bugtracker - https://bugs.g10code.com/gnupg/index

Comment 2 Petr Pisar 2015-05-14 07:38:29 UTC
Reported as <https://bugs.gnupg.org/gnupg/issue1986>.

Comment 3 Jan Kurik 2015-07-15 14:10:00 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle.
Changing version to '23'.

(As we did not run this process for some time, it could affect also pre-Fedora 23 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23

Comment 4 Andrew Cowie 2015-11-29 21:21:33 UTC
Recently upgraded Fedora 22 to Fedora 23 and this is now a problem. The gpg-agent provided by the GNOME desktop is no longer available to `gpg` on the command line, or tools like vim-gnupg etc. That's distressing. Can we (re)export the GPG_AGENT_INFO environment variable as a workaround?

AfC

Comment 5 Brian Lane 2015-11-30 18:55:28 UTC
(In reply to Andrew Cowie from comment #4)
> Recently upgraded Fedora 22 to Fedora 23 and this is now a problem. The
> gpg-agent provided by the GNOME desktop is no longer available to `gpg` on
> the command line, or tools like vim-gnupg etc. That's distressing. Can we
> (re)export the GPG_AGENT_INFO environment variable as a workaround?

You can do that in your ~/.bashrc, I'm not going to add workarounds that aren't in upstream gpg 1.4

I'm doing the following in mine:

function gpg-update() {
    GPG_PID=$(pidof gpg-agent)
    GPG_AGENT_INFO=${HOME}/.gnupg/S.gpg-agent:$GPG_PID:1
    export GPG_AGENT_INFO
}

gpg-update

Comment 6 Andrew Cowie 2015-12-01 21:35:14 UTC
(In reply to Brian Lane from comment #5)

>     GPG_PID=$(pidof gpg-agent)

Ok, fair enough, but there hasn't been a `gpg-agent` running on a GNOME desktop for a long while now. And GPG is ignoring GPG_AGENT_INFO now, it seems?

AfC

Comment 7 Brian Lane 2015-12-01 22:10:15 UTC
No, it works just fine, I use gpg --use-agent with it all the time.


Note You need to log in before you can comment on or make changes to this bug.