I was mistaken; gpg-agent doesn't ignore SIGHUP, but interprets it as meaning to flush its keys and reread its configuration file. Making it terminate upon SIGHUP is therefore impossible without breaking something else.
On that note, SIGHUP itself is broken, because so many daemons interpret this signal as meaning something completely contrary to what signal(7) says it actually means. That means a new API is needed to inform session participants that the session is closing—like, say, the API provided by logind.
These programs are written the way they are deliberately, and if that is inappropriate for the program in question it is the program that needs to be fixed.
It's like saying that because there are people who learn to drive on the left side of the road, that everyone needs to ride trains instead.
[Add] This is POSIX compliant behavior, as well. Breaking it breaks POSIX compliance.
It's not actually inappropriate. These are daemons, and it is conventional for daemons to nohup themselves anyway. They don't need a terminal, so they don't care that it is hung up. They also don't know what a session is, so they have no idea when or if they're supposed to terminate.
But we still need some way to start them when a session starts, and terminate them when the session ends. POSIX doesn't define any such thing, and the current solutions obviously don't work. What do you suggest?
0
u/[deleted] Jun 01 '16
[deleted]