Describe the bug
When nutcracker is run with the -d option (to daemonize), nutcracker internally sets its umask to 0. When -d is not specified, nutcracker leaves its umask alone.
Expected behavior
Nutcracker leaving the umask alone is arguably better (so that the local administrator can specify the umask), but either way, I think nutcracker should be internally consistent.
Additional context
This issue causes unexpected behavior when migrating from sysvinit to systemd. Common practice for systemd is to run daemons in the foreground.
A workaround for systemd is to use the UMask option.
Describe the bug When nutcracker is run with the
-d
option (to daemonize), nutcracker internally sets its umask to 0. When-d
is not specified, nutcracker leaves its umask alone.To Reproduce Steps to reproduce the behavior:
Set shell umask, e.g.:
Run nutcracker as e.g.:
Observe umask:
Kill nutcracker and then run without
-d
, e.g.:Observe umask:
Expected behavior Nutcracker leaving the umask alone is arguably better (so that the local administrator can specify the umask), but either way, I think nutcracker should be internally consistent.
Additional context
This issue causes unexpected behavior when migrating from sysvinit to systemd. Common practice for systemd is to run daemons in the foreground.
A workaround for systemd is to use the
UMask
option.https://www.freedesktop.org/software/systemd/man/systemd.exec.html
Credit for the gdb one-liner: https://stackoverflow.com/questions/165212/linux-getting-umask-of-an-already-running-process/38861278#38861278
Thanks, Corey