GNU bug report logs -
#16262
24.3.50; Mac OSX emacs --daemon reports "server did not start correctly"
Previous Next
Reported by: Phillip Dixon <phil <at> dixon.gen.nz>
Date: Fri, 27 Dec 2013 00:32:02 UTC
Severity: normal
Found in version 24.3.50
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
In GNU Emacs 24.3.50.1 (x86_64-apple-darwin13.0.0, NS apple-appkit-1265.00)
of 2013-12-25 on pdAir.local
Windowing system distributor `Apple', version 10.3.1265
Configured using:
`configure --with-ns'
Important settings:
locale-coding-system: utf-8-unix
When launch emacs using
emacs -Q --daemon
The daemon starts but reports
Error: server did not start correctly
Among other things this means that trying to auto launch the daemon
using
emacsclient -a ""
doesn't work.
emacs 24.3 correctly reports that the daemon launch.
The issue appears to have been introduced by changeset
rev. 113315, Make file descriptors close-on-exec when possible.
The NS port uses a pipe between the parent and child processes to signal
when the newly forked child is ready. rev 113315 makes the pipe used to
do this synchronisation unavailable to the child process.
The following patch reverts the portions of rev. 113315 that impact
daemon launch on NS. It seems to fix the problem for me.
diff --git a/src/emacs.c b/src/emacs.c
index 35e8ff3..53f65c0 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1026,7 +1026,7 @@ main (int argc, char **argv)
use a pipe for synchronization. The parent waits for the child
to close its end of the pipe (using `daemon-initialized')
before exiting. */
- if (emacs_pipe (daemon_pipe) != 0)
+ if (pipe(daemon_pipe) == -1)
{
fprintf (stderr, "Cannot pipe!\n");
exit (1);
@@ -1122,7 +1122,9 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
daemon_name = xstrdup (dname_arg);
/* Close unused reading end of the pipe. */
emacs_close (daemon_pipe[0]);
-
+ /* Make sure that the used end of the pipe is closed on exec,
+ that it is not accessible to programs started from .emacs. */
+ fcntl (daemon_pipe[1], F_SETFD, FD_CLOEXEC);
setsid ();
#else /* DOS_NT */
fprintf (stderr, "This platform does not support the -daemon flag.\n");
This bug report was last modified 10 years and 354 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.