(It's pretty safe, because it only extends the systemd timeout. But we should check it doesn't extend the timeout too much.)
As I explained on the PR, it doesn't matter too much if the number sent is too high, since systemd will continue immediately as long as tor actually exits before the timeout (it's a maximum limit, not a minimum or exact). If tor doesn't exit expeditiously, then that's a bug in tor. IMO it's worth trying to work around the (still hypothetical AFAIK) bug by waiting a little longer, rather than crashing and almost certainly corrupting cache files. Also, I figure nobody will care excessively if they set ShutdownWaitLength to 2 minutes and tor actually takes 2 minutes 15 seconds to quit, as long as we don't accidentally make it 20 minutes (but again, that would require another separate bug in tor).
I pushed three small commits to your pull request to fix these issues:
If tor's systemd TimeoutStopSec is less than the ShutdownWaitLength, plus the time it takes tor to shut down after its ShutdownWaitLength has expired, then systemd may terminate Tor abnormally. Let's explain that better in the changes file.
Hm. Apparently this broke with systemd-devel installed. 212bd9778b5c249f02f8fbdc1e8ccbe4c108f03a made it work for me, but I'm a little worried about how tested this could be.
Hm. Apparently this broke with systemd-devel installed. 212bd9778b5c249f02f8fbdc1e8ccbe4c108f03a made it work for me, but I'm a little worried about how tested this could be.
I didn't test with libsystemd-devel, and travis doesn't have libsystemd-devel installed.
So I guess that just leaves any testing that Hello71 did.
I use Arch which includes devel files in the standard package. It turns out, though, that I either accidentally removed the patch from my local list or never included it in the first place, so it would seem that I haven't tested this at all. I may have assumed that Travis had systemd-devel already. Patch is already applied though, and seems like too much work to back it out, so let's say test it for a little while and see if anyone complains. :P
well the code was committed, and as far as I can tell it just doesn't work. I haven't had time to figure out why, and I doubt I'll have time in the near to medium term future.
I think the systemd service doesn't require any (more) fixing. as far as I know, the TimeoutStopSec is sufficient in all distributions now. the problem is just that if you increase ShutdownWaitLength (in tor), you may need to also increase TimeoutStopSec in systemd. this is really a nice-to-have though; the code can be removed and this ticket closed if nobody wants to work on it.