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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16262 in the body.
You can then email your comments to 16262 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#16262
; Package
emacs
.
(Fri, 27 Dec 2013 00:32:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Phillip Dixon <phil <at> dixon.gen.nz>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 27 Dec 2013 00:32:02 GMT)
Full text and
rfc822 format available.
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");
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#16262
; Package
emacs
.
(Sat, 28 Dec 2013 23:01:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 16262 <at> debbugs.gnu.org (full text, mbox):
Thanks for the bug report. Your fix has a small race condition,
in that some other thread could fork and exec while the pipe's close-on-exec
flag is clear. I installed a different fix as trunk bzr 115799, which
should avoid that race condition. Please give it a try when you have the chance.
bug closed, send any further explanations to
16262 <at> debbugs.gnu.org and Phillip Dixon <phil <at> dixon.gen.nz>
Request was from
Paul Eggert <eggert <at> cs.ucla.edu>
to
control <at> debbugs.gnu.org
.
(Sun, 29 Dec 2013 18:36:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#16262
; Package
emacs
.
(Thu, 02 Jan 2014 22:03:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 16262 <at> debbugs.gnu.org (full text, mbox):
Hi,
Your fix is working correctly on my machine (Mac OSX 10.9).
Thank you
Phil
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 31 Jan 2014 12:24:04 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Grant Izmirlian <izmirlig <at> mail.nih.gov>
to
control <at> debbugs.gnu.org
.
(Tue, 29 Jul 2014 23:55:04 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 27 Aug 2014 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 9 years and 250 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.