troglobit / finit

Fast init for Linux. Cookies included
https://troglobit.com/projects/finit/
MIT License
622 stars 61 forks source link

Mark service dirty if the command line args have changed #333

Closed JackNewman12 closed 1 year ago

JackNewman12 commented 1 year ago

This fixes initctl reload correctly restarting all daemons that have new command line arguments. Previously command line arguments changes were only acted upon if the service was explicitly reloaded using initctl reload myservice since it blindly sets the svc->dirty flag.

When checking if a service should be restarted, svc_is_changed() checks for the svc->dirty flag, and then only after that will svc_sighup() look for the svc->args_dirty flag. Hence a difference in command line arguments would not result in a service being restarted. https://github.com/troglobit/finit/blob/9887003b25355c94c46e05985b9738297df6f1a8/src/service.c#L2289-L2293

You could also add the || svc->args_dirty check into the svc_is_changed(), but I think it makes sense this way.

troglobit commented 1 year ago

Nice catch, thanks!

Dunno why one of the tests fail. Running the same patch on my local system is 100% success. So I'm merging this and moving on to the next PR. If the test issue remains I'll have a look at that separately, because your patch is sound regardless.