Subject: Re: src/temacs --daemon fails

From: Alex Bennée <[email-masked]>
Date: Sun, 16 Feb 2014 21:34:57 +0000

Eli Zaretskii <[email-masked]> writes:

>> From: Alex Bennée <[email-masked]>
>> Date: Thu, 30 Jan 2014 14:10:45 +0000
>> 
>> In an unrelated issue I found that I can't start src/temacs with the
>> --daemon option which works with the dumped version src/emacs.
>
> Please use "M-x report-emacs-bug RET" to report such bugs, then they
> are automatically emailed to the bug tracker address.

I raised bug #16599 and I have tracked it down to being reset by
syms_of_emacs() which is called in temacs after being set up by
--daemon. I assume the dumped src/emacs behaves differently.

The following patch works for me:

>From 3dee0d9da394e17b4e6cb97cb22399f027cab440 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alex=20Benn=C3=A9e?= <[email-masked]>
Date: Sun, 16 Feb 2014 20:59:06 +0000
Subject: [PATCH] src/emacs.c: ensure daemon_pipe initialised before use

Otherwise this breaks src/temacs --daemon invocations by resetting the
daemon_pipe FDs which are used to determine if Emacs is in daemon mode.
---
 src/emacs.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/emacs.c b/src/emacs.c
index 18f6a08..66f47ef 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -201,7 +201,7 @@ static char *daemon_name;
 
 /* Pipe used to send exit notification to the daemon parent at
    startup.  */
-int daemon_pipe[2];
+int daemon_pipe[2] = {0, 0};
 
 /* Save argv and argc.  */
 char **initial_argv;
@@ -2548,7 +2548,4 @@ libraries; only those already known by Emacs will be loaded.  */);
   Vlibrary_cache = Qnil;
   staticpro (&Vlibrary_cache);
 #endif
-
-  /* Make sure IS_DAEMON starts up as false.  */
-  daemon_pipe[1] = 0;
 }
-- 
1.8.5.3

> Thanks.

-- 
Alex Bennée