bug#47511: 27.1; emacs --daemon should not delete systemd socket on exit
I'm using systemd socket activation to start the Emacs daemon, as
documented in the manual section "Emacs Server". When I run emacsclient
-e '(kill-emacs)' to stop the daemon, the socket file gets deleted even
though it was not created by the daemon. Since systemd is not aware of
this, it does not recreate the socket until I run systemctl --user
restart emacs.socket. Until then, it is impossible to restart the
daemon via socket activation.
Indeed, the systemd.socket(5) man page says "A daemon listening on an
AF_UNIX socket [...] must not unlink the socket from a file system."
In my uninformed opinion, the server-sentinel function in server.el (and
possibly other functions) should be patched to avoid deleting the socket
if it was externally created, i.e. when internal--daemon-sockname is
As a temporary work-around, I advised delete-file to ignore the file
named by internal--daemon-sockname.
In GNU Emacs 27.1 (build 1, x86_64-redhat-linux-gnu, GTK+ Version
3.24.22, cairo version 1.16.0)
of 2020-08-20 built on buildhw-x86-03.iad2.fedoraproject.org
Windowing system distributor 'Fedora Project', version 11.0.12010000
System Description: Fedora 33 (Workstation Edition)
value of $LANG: en_CA.UTF-8
value of $XMODIFIERS: @im=ibus
Major mode: Lisp Interaction
Minor modes in effect: