assistant --autostart: First any daemons that are already running, which might be left over from a previous login session and so unable to use the ssh agent of a new login session.

This commit is contained in:
Joey Hess 2015-07-02 14:16:53 -04:00
parent 0609788fbe
commit 1f35141aff
3 changed files with 35 additions and 0 deletions

View file

@ -91,6 +91,12 @@ autoStart startdelay = do
where
go haveionice program dir = do
setCurrentDirectory dir
-- First stop any old daemon running in this directory, which
-- might be a leftover from an old login session. Such a
-- leftover might be left in an environment where it is
-- unavble to use the ssh agent or other login session
-- resources.
void $ boolSystem program [Param "assistant", Param "--stop"]
if haveionice
then boolSystem "ionice" (Param "-c3" : Param program : baseparams)
else boolSystem program baseparams

3
debian/changelog vendored
View file

@ -1,6 +1,9 @@
git-annex (5.20150618) UNRELEASED; urgency=medium
* log: Fix reversion introduced in version 5.20150528 that broke this command.
* assistant --autostart: First any daemons that are already running,
which might be left over from a previous login session and so unable to
use the ssh agent of a new login session.
-- Joey Hess <id@joeyh.name> Thu, 02 Jul 2015 12:31:14 -0400

View file

@ -1,3 +1,29 @@
When you logout of any x session git-annex does not get killed.
This means that if you login again git-annex will still try to use the ssh-agent from the last session which doesn't run anymore.
This leads to countless password queries unless you use a passwordless key.
> I've fixed this, though maybe not in an ideal way.
>
> There's no way to make a XDG desktop file run a command on logout, that I
> can see. That would have been my first choice.
>
> So, I thought I'd just have the assistant not run setsid, so it's part of
> the current login session and would get killed automatically on logout.
> I was surprised that this didn't seem to work, on a system using logind.
> Even when the desktop file ran git-annex with --foreground, it was not
> stopped on logout. This may be because logind defaults to
> KillUserProcesses=false,
> although I'm not sure why processes that are part of the login session
> are not killed at least.
>
> What I have settled on is to leave the daemon running after logout,
> but on a new login have the `git annex assistant --autostart` kill the
> old daemon and start a new one.
>
> Only possible problem with that is there will be a small window after
> login where the old daemon is running. It might slip in a password prompt
> there, using the new DISPLAY. At least it won't flood, and even a single
> password prompt is pretty unlikely.
>
> I am tenatively going to call this [[done]]. Seems to me that logind
> could be improved though. --[[Joey]]