all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* src/temacs --daemon fails
@ 2014-01-30 14:10 Alex Bennée
  2014-01-30 16:22 ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Alex Bennée @ 2014-01-30 14:10 UTC (permalink / raw)
  To: Emacs developers

Hi,

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.

With both:

host-dbus host-x11 src/temacs --daemon
host-dbus host-x11 src/temacs -Q --daemon

I get a window popping up and when I execute (daemonp) I get nill. When
I C-x C-c the rather terse message:

Error: server did not start correctly

Is left on the terminal.

The host-* functions are simply functions to ensure the environment
variables are set-up for my crouton in ChromeOS shell to use the host
X11 server.


Cheers,

--
Alex Bennée
http://www.bennee.com/~alex




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: src/temacs --daemon fails
  2014-01-30 14:10 src/temacs --daemon fails Alex Bennée
@ 2014-01-30 16:22 ` Eli Zaretskii
  2014-02-16 21:34   ` bug#16599: " Alex Bennée
  2014-02-16 21:34   ` Alex Bennée
  0 siblings, 2 replies; 12+ messages in thread
From: Eli Zaretskii @ 2014-01-30 16:22 UTC (permalink / raw)
  To: Alex Bennée; +Cc: emacs-devel

> From: Alex Bennée <kernel-hacker@bennee.com>
> 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.

Thanks.




^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#16599: src/temacs --daemon fails
  2014-01-30 16:22 ` Eli Zaretskii
@ 2014-02-16 21:34   ` Alex Bennée
  2014-02-16 21:57     ` Andreas Schwab
  2014-02-16 21:57     ` Andreas Schwab
  2014-02-16 21:34   ` Alex Bennée
  1 sibling, 2 replies; 12+ messages in thread
From: Alex Bennée @ 2014-02-16 21:34 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 16599, Alex Bennée, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 627 bytes --]


Eli Zaretskii <eliz@gnu.org> writes:

>> From: Alex Bennée <kernel-hacker@bennee.com>
>> 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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Fix initialistion of daemon_pipes --]
[-- Type: text/x-diff, Size: 1039 bytes --]

From 3dee0d9da394e17b4e6cb97cb22399f027cab440 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex@bennee.com>
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


[-- Attachment #3: Type: text/plain, Size: 33 bytes --]



>
> Thanks.

-- 
Alex Bennée


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: src/temacs --daemon fails
  2014-01-30 16:22 ` Eli Zaretskii
  2014-02-16 21:34   ` bug#16599: " Alex Bennée
@ 2014-02-16 21:34   ` Alex Bennée
  1 sibling, 0 replies; 12+ messages in thread
From: Alex Bennée @ 2014-02-16 21:34 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 16599, Alex Bennée, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 627 bytes --]


Eli Zaretskii <eliz@gnu.org> writes:

>> From: Alex Bennée <kernel-hacker@bennee.com>
>> 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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Fix initialistion of daemon_pipes --]
[-- Type: text/x-diff, Size: 1039 bytes --]

From 3dee0d9da394e17b4e6cb97cb22399f027cab440 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex@bennee.com>
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


[-- Attachment #3: Type: text/plain, Size: 33 bytes --]



>
> Thanks.

-- 
Alex Bennée


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* bug#16599: src/temacs --daemon fails
  2014-02-16 21:34   ` bug#16599: " Alex Bennée
@ 2014-02-16 21:57     ` Andreas Schwab
  2014-02-16 21:57     ` Andreas Schwab
  1 sibling, 0 replies; 12+ messages in thread
From: Andreas Schwab @ 2014-02-16 21:57 UTC (permalink / raw)
  To: Alex Bennée; +Cc: 16599, emacs-devel

Alex Bennée <kernel-hacker@bennee.com> writes:

> 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};

This is redundant.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: bug#16599: src/temacs --daemon fails
  2014-02-16 21:34   ` bug#16599: " Alex Bennée
  2014-02-16 21:57     ` Andreas Schwab
@ 2014-02-16 21:57     ` Andreas Schwab
  2014-02-17  7:40       ` Alex Bennée
  2014-02-17  7:40       ` Alex Bennée
  1 sibling, 2 replies; 12+ messages in thread
From: Andreas Schwab @ 2014-02-16 21:57 UTC (permalink / raw)
  To: Alex Bennée; +Cc: Eli Zaretskii, 16599, emacs-devel

Alex Bennée <kernel-hacker@bennee.com> writes:

> 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};

This is redundant.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#16599: src/temacs --daemon fails
  2014-02-16 21:57     ` Andreas Schwab
  2014-02-17  7:40       ` Alex Bennée
@ 2014-02-17  7:40       ` Alex Bennée
  1 sibling, 0 replies; 12+ messages in thread
From: Alex Bennée @ 2014-02-17  7:40 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 16599, Alex Bennée, emacs-devel


Andreas Schwab <schwab@linux-m68k.org> writes:

> Alex Bennée <kernel-hacker@bennee.com> writes:
>
>> 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};
>
> This is redundant.

Indeed. I wasn't sure if the code I replaced relied on some special
difference between .data and .bss sections. I have to admit I'm
unfamiliar with how the Emacs dumping mechanism works.

Why did the syms_of_emacs() function feel the need to initialise daemon_pipe?

>
> Andreas.

-- 
Alex Bennée






^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: bug#16599: src/temacs --daemon fails
  2014-02-16 21:57     ` Andreas Schwab
@ 2014-02-17  7:40       ` Alex Bennée
  2014-02-17 15:51         ` Eli Zaretskii
  2014-02-17  7:40       ` Alex Bennée
  1 sibling, 1 reply; 12+ messages in thread
From: Alex Bennée @ 2014-02-17  7:40 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Eli Zaretskii, 16599, Alex Bennée, emacs-devel


Andreas Schwab <schwab@linux-m68k.org> writes:

> Alex Bennée <kernel-hacker@bennee.com> writes:
>
>> 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};
>
> This is redundant.

Indeed. I wasn't sure if the code I replaced relied on some special
difference between .data and .bss sections. I have to admit I'm
unfamiliar with how the Emacs dumping mechanism works.

Why did the syms_of_emacs() function feel the need to initialise daemon_pipe?

>
> Andreas.

-- 
Alex Bennée




^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#16599: src/temacs --daemon fails
  2014-02-17  7:40       ` Alex Bennée
@ 2014-02-17 15:51         ` Eli Zaretskii
  2014-02-17 16:03           ` Andreas Schwab
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2014-02-17 15:51 UTC (permalink / raw)
  To: Alex Bennée; +Cc: 16599, schwab

> From: Alex Bennée <kernel-hacker@bennee.com>
> Cc: Alex Bennée <kernel-hacker@bennee.com>, Eli Zaretskii
>  <eliz@gnu.org>, 16599@debbugs.gnu.org, emacs-devel@gnu.org
> Date: Mon, 17 Feb 2014 07:40:35 +0000
> 
> Why did the syms_of_emacs() function feel the need to initialise daemon_pipe?

Because in a dumped Emacs, daemon_pipe might hold a stale value from
before the dumping.

Does the patch below solve this problem?

=== modified file 'src/emacs.c'
--- src/emacs.c	2014-01-20 19:44:56 +0000
+++ src/emacs.c	2014-02-17 15:48:44 +0000
@@ -2550,5 +2550,6 @@ libraries; only those already known by E
 #endif
 
   /* Make sure IS_DAEMON starts up as false.  */
-  daemon_pipe[1] = 0;
+  if (initialized)
+    daemon_pipe[1] = 0;
 }






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#16599: src/temacs --daemon fails
  2014-02-17 15:51         ` Eli Zaretskii
@ 2014-02-17 16:03           ` Andreas Schwab
  2014-02-17 16:15             ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2014-02-17 16:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 16599, Alex Bennée

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Alex Bennée <kernel-hacker@bennee.com>
>> Cc: Alex Bennée <kernel-hacker@bennee.com>, Eli Zaretskii
>>  <eliz@gnu.org>, 16599@debbugs.gnu.org, emacs-devel@gnu.org
>> Date: Mon, 17 Feb 2014 07:40:35 +0000
>> 
>> Why did the syms_of_emacs() function feel the need to initialise daemon_pipe?
>
> Because in a dumped Emacs, daemon_pipe might hold a stale value from
> before the dumping.

But syms_of_emacs is not called in a dumped Emacs.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#16599: src/temacs --daemon fails
  2014-02-17 16:03           ` Andreas Schwab
@ 2014-02-17 16:15             ` Eli Zaretskii
  2014-02-17 16:38               ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2014-02-17 16:15 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 16599, kernel-hacker

> From: Andreas Schwab <schwab@suse.de>
> Cc: Alex Bennée <kernel-hacker@bennee.com>,
>   16599@debbugs.gnu.org
> Date: Mon, 17 Feb 2014 17:03:01 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> From: Alex Bennée <kernel-hacker@bennee.com>
> >> Cc: Alex Bennée <kernel-hacker@bennee.com>, Eli Zaretskii
> >>  <eliz@gnu.org>, 16599@debbugs.gnu.org, emacs-devel@gnu.org
> >> Date: Mon, 17 Feb 2014 07:40:35 +0000
> >> 
> >> Why did the syms_of_emacs() function feel the need to initialise daemon_pipe?
> >
> > Because in a dumped Emacs, daemon_pipe might hold a stale value from
> > before the dumping.
> 
> But syms_of_emacs is not called in a dumped Emacs.

So I guess we should move that line somewhere where it will be called.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#16599: src/temacs --daemon fails
  2014-02-17 16:15             ` Eli Zaretskii
@ 2014-02-17 16:38               ` Eli Zaretskii
  0 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2014-02-17 16:38 UTC (permalink / raw)
  To: Alex Bennée; +Cc: schwab, 16599

> Date: Mon, 17 Feb 2014 18:15:58 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 16599@debbugs.gnu.org, kernel-hacker@bennee.com
> 
> > From: Andreas Schwab <schwab@suse.de>
> > Cc: Alex Bennée <kernel-hacker@bennee.com>,
> >   16599@debbugs.gnu.org
> > Date: Mon, 17 Feb 2014 17:03:01 +0100
> > 
> > Eli Zaretskii <eliz@gnu.org> writes:
> > 
> > >> From: Alex Bennée <kernel-hacker@bennee.com>
> > >> Cc: Alex Bennée <kernel-hacker@bennee.com>, Eli Zaretskii
> > >>  <eliz@gnu.org>, 16599@debbugs.gnu.org, emacs-devel@gnu.org
> > >> Date: Mon, 17 Feb 2014 07:40:35 +0000
> > >> 
> > >> Why did the syms_of_emacs() function feel the need to initialise daemon_pipe?
> > >
> > > Because in a dumped Emacs, daemon_pipe might hold a stale value from
> > > before the dumping.
> > 
> > But syms_of_emacs is not called in a dumped Emacs.
> 
> So I guess we should move that line somewhere where it will be called.

Like in the patch below.  Alex, please try this one instead of the one
I sent before.

=== modified file 'src/emacs.c'
--- src/emacs.c	2014-01-20 19:44:56 +0000
+++ src/emacs.c	2014-02-17 16:36:32 +0000
@@ -721,6 +721,9 @@ main (int argc, char **argv)
   /* If we use --chdir, this records the original directory.  */
   char *original_pwd = 0;
 
+  /* Make sure IS_DAEMON starts up as false.  */
+  daemon_pipe[1] = 0;
+
 #if GC_MARK_STACK
   stack_base = &dummy;
 #endif
@@ -2548,7 +2551,4 @@ libraries; only those already known by E
   Vlibrary_cache = Qnil;
   staticpro (&Vlibrary_cache);
 #endif
-
-  /* Make sure IS_DAEMON starts up as false.  */
-  daemon_pipe[1] = 0;
 }






^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-02-17 16:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-30 14:10 src/temacs --daemon fails Alex Bennée
2014-01-30 16:22 ` Eli Zaretskii
2014-02-16 21:34   ` bug#16599: " Alex Bennée
2014-02-16 21:57     ` Andreas Schwab
2014-02-16 21:57     ` Andreas Schwab
2014-02-17  7:40       ` Alex Bennée
2014-02-17 15:51         ` Eli Zaretskii
2014-02-17 16:03           ` Andreas Schwab
2014-02-17 16:15             ` Eli Zaretskii
2014-02-17 16:38               ` Eli Zaretskii
2014-02-17  7:40       ` Alex Bennée
2014-02-16 21:34   ` Alex Bennée

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.