Created attachment 4371 Fix-gpg-agent-shutdown.patch If gpg-agent was started without ssh support then its pid is not stored in the SSH_AGENT_PID variable, but running_sshagent is setted to "gpg-agent". So while session shutdown xfce4-session sends SIGINT to the ssh-agent that didn't started by xfce4-session and don't terminate the gpg-agent. I don't sure about this patch, may be best solution will be just don't start gpg-agent without ssh support at all.
Well, as far as I can tell, the all handling of agents is a bit inconsistent. Basically xfce4-session seems to behaves like the only agent it cares about is the ssh one. Then, one can either use ssh-agent directly, or gpg-agent with --enable-ssh-agent. The case where people might want to use gpg-agent only for handling gpg-agent and still keep ssh-agent is not really handled, afaict.
In my opinion, the handling should be done like : if !/startup/gpg-agent/enabled || /startup/gpg-agent/enabled == true; if !GPG_AGENT_INFO || (GPG_AGENT_INFO && GPG_AGENT_INFO points to garbage); run gpg-agent remember/export environment remember gpg-agent was run # ssh-agent mode of gpg-agent should be handled in .gnupg/gpg-agent.conf # but in case it's not, handling it here might work fi fi if !/startup/ssh-agent/enabled || /startup/ssh-agent/enabled == true; if !SSH_AGENT_PID || (SSH_AGENT_PID && SSH_AGENT_PID points to garbage); # if gpg-agent has been started in ssh-agent mode just above, # SSH_AGENT_PID will be set. same thing if it has been started by another # script run ssh-agent remember/export environment remember ssh-agent was run fi fi What do you think?
Created attachment 5079 Handle-gpg-and-ssh-agents-separately.patch Yes, handling gpg and ssh agents separately is the best solution. Patch is attached. I didn't drop the handling of /startup/ssh-agent/type, but this can simplify code a bit. I think the gpg-agent shouldn't be launched with SSH support by default: it may not support some SSH keys types that are supported by the ssh-agent (same problem with gnome-keyring, see https://bugzilla.gnome.org/show_bug.cgi?id=641082 for example).
Thanks, pushed to master in: http://git.xfce.org/xfce/xfce4-session/commit/?id=7892794fbf029a3b15d9e1320cf701bf0d31fd83