Skip to content

fix: give each daemon child a private Emacs server name - #2

Merged
clhodapp merged 1 commit into
mainfrom
fix/daemon-server-name
Sep 8, 2026
Merged

clhodapp merged 1 commit into
mainfrom
fix/daemon-server-name

Conversation

@clhodapp

@clhodapp clhodapp commented Sep 8, 2026

Copy link
Copy Markdown
Owner

The two daemon-child tests (parenting-spawn-daemon-child-is-interactive, parenting-remote-daemon-child) fail on any machine that already runs an Emacs daemon under the default name, and pass in CI only because nothing runs a daemon there.

Cause. A :daemon child ran with a bare --fg-daemon, so its server was named server. Emacs starts a daemon's server after processing the command line and refuses to start at all when that name is taken. The child's stderr shows it:

Starting Emacs daemon.
Warning (server): Unable to start the Emacs server.
The existing Emacs server, called "server", could not be stopped.
Unable to start the daemon.
Another instance of Emacs is running the server, either as daemon or interactively.

The parent sees the hello, then parenting-closed. The same collision meant two daemon children could not coexist anywhere, CI included.

Fix. parenting-spawn passes --fg-daemon=NAME, with NAME from make-temp-name on the child's process name. :daemon also accepts a string to choose the name explicitly. The docstring and README say so. parenting-spawn-remote inherits the change through its :daemon pass-through.

Tests. Two new ERT tests: two daemon children spawned side by side get distinct server names and neither is server, and a string :daemon reaches server-name. Against the old code in a daemon-free environment the collision test fails while the original daemon tests pass, so it catches the bug in CI. With the fix, all 56 tests pass on a desktop with a live daemon under Emacs 31.1.

🤖 Generated with Claude Code

A :daemon child ran with a bare --fg-daemon, so its server took the
default name "server". Emacs starts a daemon's server after the
command line is processed and refuses to start at all when that name
is already held, so the child said hello over the parenting socket and
then exited wherever an Emacs daemon was already running under the
default name, which is the usual desktop setup. The same collision
kept two daemon children from coexisting anywhere. CI never saw it
because no daemon runs there.

parenting-spawn now passes --fg-daemon=NAME, with NAME from
make-temp-name on the child's process name, and accepts a string for
:daemon to choose the name outright. Two tests cover it: two daemon
children spawned side by side with distinct server names, neither of
them "server", and a string :daemon reaching server-name.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@clhodapp clhodapp self-assigned this Sep 8, 2026
@clhodapp
clhodapp merged commit e3a170e into main Sep 8, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant