fix: give each daemon child a private Emacs server name - #2
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
:daemonchild ran with a bare--fg-daemon, so its server was namedserver. 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:The parent sees the hello, then
parenting-closed. The same collision meant two daemon children could not coexist anywhere, CI included.Fix.
parenting-spawnpasses--fg-daemon=NAME, with NAME frommake-temp-nameon the child's process name.:daemonalso accepts a string to choose the name explicitly. The docstring and README say so.parenting-spawn-remoteinherits the change through its:daemonpass-through.Tests. Two new ERT tests: two daemon children spawned side by side get distinct server names and neither is
server, and a string:daemonreachesserver-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