Over on https://bugs.debian.org/853905 there's a (occasionally frustrating)
discussion about how to make gpg-agent minimize its presence on the host
machine. Some people really don't like having idle processes lying around.
It occurs to me that if the agent can be cleanly and automatically launched when
needed, and the startup cost is not high, then whenever it reaches a stateless
point, it can just terminate quietly and politely.
So the question is "what is stateless"?
In the current implementation, it's at least:
- all cached passphrases have expired
- no scdaemon is running (i'm happy to figure out scdaemon as well, but the
no-scdaemon case is easier to reason about)
- no currently-open connections
- updatestartuptty has never been called
Maybe we could even wait some fixed amount of time after this state has been
reached before we conclude we're not wanted, though that sounds like an extra
knob to twiddle.
Would that be sufficient to allow it to terminate quietly in some
configurations? I wouldn't want this to happen automatically, but it might be
an option --terminate-when-idle (or, if we want the extra knob,
--terminate-after-idle-seconds=N).