r/linux • u/rain5 • May 28 '16
systemd developer asks tmux (and other programs) to add systemd specific code
https://github.com/tmux/tmux/issues/428
359
Upvotes
r/linux • u/rain5 • May 28 '16
View all comments
Show parent comment
4
u/webpigeon May 29 '16
I can see that the code uses the function (and even has a compat version of the function in case it's not supported). Tmux is not trying to be a system daemon, it just wants to stick around past the session's demise. A much cleaner way of doing it would be to have it start a separate session.
It's much cleaner to have real daemons managed by the init system rather than forking and exiting the parent process a few times. Processes which do this are difficult to look after correctly. It's also much cleaner for logging and management.
I'm not saying that users shouldn't be able to have long running detached processes, I look after servers (using screen for long running tasks which I can check back on later) and run long running tasks as a user on a cluster (running calculations which the results can be collected from later). At the same time I'd rather that badly written code which doesn't correctly clean up after itself is not left to linger after the user has logged out (can you imagine an environment like a university where the computer is used by 20 or 30 students in a 24 hour period and perhaps rebooted once a week?). No, the code shouldn't be buggy and should clean up after itself but code which doesn't is already out there, running on systems.
Programs which are legitimately needing to stick around need a way of telling the system that but doing it in a way which is transparent to the init system is a good idea. This strategy also appears to be creating the components needed to make the program a legitimate, system managed, process. It also makes it easier to write policies which permit some users running detached tasks but not others.
The init system knows what is around, why it is around and what happened to make it stick around. There are other parts of this comment thread that detail how, as a user, you would be able to run a long running (detatched) process using systemd. The systemd developers asked to include part of this new code in tmux, it's a Free Software project, anyone can ask for features or make recommendations - that's one of the things which makes the Free Software community great. Imho, it's not a bad thing that they realised that their change could cause an issue and are looking to make sure that issue doesn't become a problem for end users. The Debian maintainer also seems to believe this is worthy of inclusion.
If you believe that it's going to be a problem for you and you want the old behaviour, you are free to edit the configuration on your machines. The proposed change seems like a sensible default me. If the issue is an extra (optional) compile time dependency on dbus, pam or some systemd lib then I guess that the distros could always patch the code themselves - but that seems like a lot of duplication of effort. The fact the proposal included a optional compile time flag does seem to make this argument a bit moot though.
tl;dr nothing about this change stops you running detached processes, the systemd developers could have just changed it and not tried to warn other projects, your detached processes would have terminated on logout and everyone would be complaining about them not doing enough to let people know.