Subject: bug#75460: herd status hangs forever

From: Ludovic Courtès <[email-masked]>
Date: Sun, 12 Jan 2025 17:40:16 +0100

Hello,

Simen Endsjø <[email-masked]> skribis:

> Oh, I only checked some services and assumed all was working. All the
> following services hang. The common denominator is that I have written
> these myself, so I might be doing something odd here.
>
> • xss-lock
> • volctl
> • picom
> • network-manager-applet
> • dunst
> • cbatticon
> • blueman-applet
>
> For example xss-lock:
> <https://git.sr.ht/~simendsjo/dotfiles/tree/main/item/sijo/home/services/xss-lock.scm#L7-30>

Yes, I already looked at all of them just in case :-) and didn’t notice
anything fishy.

One suggestion:

diff --git a/sijo/home/services/emacs-daemon.scm b/sijo/home/services/emacs-daemon.scm
index 5e438b8..32d6ae0 100644
--- a/sijo/home/services/emacs-daemon.scm
+++ b/sijo/home/services/emacs-daemon.scm
@@ -11,7 +11,7 @@
     (modules '((shepherd support)))  ;for '%user-runtime-dir'
     (start #~(lambda ()
               (let ((socket (string-append %user-runtime-dir "/emacs/server")))
-                (unless (file-exists? socket)
+                (and (not (file-exists? socket))
                      (fork+exec-command (list "emacs" "--fg-daemon"))))))
     (stop #~(make-kill-destructor)))))

Otherwise you end up with ‘emacs-daemon’ marked as “started” with
#<unspecified> as its running value, causing an exception (type error)
when attempting to stop it.

> ┌────
> │ 2025-01-12 16:39:26 GNU Shepherd 1.0.0 (Guile 3.0.9, x86_64-unknown-linux-gnu)
> │ 2025-01-12 16:39:26 Starting service root...

Nothing stands out here, but this log is much recent than your initial
report.  Is ‘herd status’ still hanging?  IOW, is it 100% reproducible?

Thanks,
Ludo’.