After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 454469 - Crashes when ssh key is added and gnupg-agent is running
Crashes when ssh key is added and gnupg-agent is running
Status: RESOLVED FIXED
Product: seahorse
Classification: Applications
Component: Daemon
1.0.x
Other Linux
: Normal normal
: 2.20.0
Assigned To: Seahorse Maintainer
Seahorse Maintainer
Depends on:
Blocks:
 
 
Reported: 2007-07-07 05:46 UTC by Ted Percival
Modified: 2007-07-07 13:59 UTC
See Also:
GNOME target: ---
GNOME version: 2.17/2.18


Attachments
A fix. (546 bytes, patch)
2007-07-07 05:47 UTC, Ted Percival
none Details | Review
Fixes the bug (1.80 KB, patch)
2007-07-07 13:59 UTC, Adam Schreiber
committed Details | Review

Description Ted Percival 2007-07-07 05:46:25 UTC
When gnupg-agent is enabled and seahorse is used for managing ssh keys, it crashes as soon as a key is added because the seahorse-agent cache is not initialised.

Steps to reproduce:
1. Make sure gnupg-agent is installed and running (check that GPG_AGENT_INFO is in your environment)
2. Run ssh-add to add an ssh key to your agent (seahorse).

seahorse-agent dies almost exactly when I have just run ssh-add.

This is Debian bug #407800: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=407800

I will attach a patch. Here is an analysis of the bug.

Program received signal SIGABRT, Aborted.

Thread NaN (LWP 7812)

  • #0 ??
  • #1 ??
  • #2 ??
  • #3 ??
  • #4 raise
    from /lib/i686/cmov/libc.so.6
  • #5 abort
    from /lib/i686/cmov/libc.so.6
  • #6 g_logv
    from /usr/lib/libglib-2.0.so.0
  • #7 g_log
    from /usr/lib/libglib-2.0.so.0
  • #8 g_assert_warning
    from /usr/lib/libglib-2.0.so.0
  • #9 seahorse_agent_cache_count
    at seahorse-agent-cache.c line 435
  • #10 seahorse_agent_status_update
    at seahorse-agent-status.c line 355
  • #11 update_status
    at seahorse-agent-ssh.c line 350
  • #12 ??
    from /usr/lib/libglib-2.0.so.0
  • #13 ??

Here's what happens.

main [0]
  seahorse_agent_prefork [1]
  seahorse_agent_init [2]
    seahorse_agent_cache_init [3]
  gtk_main
    { ... }
      g_timeout_add (update_status) [4]
    update_status
      seahorse_agent_status_update
        seahorse_agent_cache_count
          g_assert [5]


[0] Program starts.

[1] seahorse_agent_prefork() detects another GPG agent already running 
and returns early, leaving seahorse_agent_enabled (global) set to FALSE.

[2] seahorse_agent_init() returns immediately because 
seahorse_agent_enabled was FALSE.

[3] seahorse_agent_cache_init() is /not/ called, leaving the global 
g_cache variable as NULL.

[4] A key is added by the user with ssh-add, it gets picked up by 
seahorse and the update_status timer is installed.

[5] The update_status timer is called and asserts because g_cache is NULL.
Comment 1 Ted Percival 2007-07-07 05:47:59 UTC
Created attachment 91333 [details] [review]
A fix.

This patch fixes the problem by ensuring the g_cache is initialised even when seahorse is not being used as a GPG agent.
Comment 2 Ted Percival 2007-07-07 05:56:56 UTC
I think this is the same as bug #399479 and bug #419019.
Comment 3 Adam Schreiber 2007-07-07 13:59:35 UTC
Created attachment 91361 [details] [review]
Fixes the bug

Thanks for looking into the bug.  I had to add some stuff to your patch to keep things from breaking when using seahorse-agent as both a gpg and ssh agent and this patch includes them.

2007-07-07  Adam Schreiber  <sadam@clemson.edu>
    
    * agent/seahorse-agent-cache.c:
    * agent/seahorse-agent-ssh.c: When only using the ssh portion of 
    seahorse-agent, still init the cache.  Patch from Ted Percival.
    Fixes bug #454469