From: Eli Zaretskii <eliz@gnu.org>
To: Spencer Baugh <sbaugh@janestreet.com>
Cc: 68799@debbugs.gnu.org
Subject: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails
Date: Mon, 29 Jan 2024 19:11:36 +0200 [thread overview]
Message-ID: <86y1c82hfb.fsf@gnu.org> (raw)
In-Reply-To: <iersf2gjd1e.fsf@igm-qws-u22796a.mail-host-address-is-not-set> (message from Spencer Baugh on Mon, 29 Jan 2024 11:54:21 -0500)
> From: Spencer Baugh <sbaugh@janestreet.com>
> Date: Mon, 29 Jan 2024 11:54:21 -0500
>
>
> 1. emacs -Q --fg-daemon=/nonexistent/dir/sock
> 2. Emacs prints "Starting Emacs daemon." and sits in foreground.
> 3. emacsclient -c -s /nonexistent/dir/sock
> 4. emacsclient prints and exits:
> emacsclient: can't find socket; have you started the server?
> emacsclient: To start the server in Emacs, type "M-x server-start".
> emacsclient: error accessing socket "/nonexistent/dir/sock"
>
> This is because in step 1, the server actually failed to start, but
> Emacs did not log that at all. In fact, it's impossible to access the
> Emacs started in 1 now, since it's not actually running a server and it
> has no frames.
>
> The same thing happens with --bg-daemon, although it's slightly more
> obvious that something is wrong in that case, because --bg-daemon is not
> supposed to sit in foreground.
>
> Emacs with --fg-daemon should instead print an error and exit if it
> fails to start the server.
Have some faith in Emacs: we already do that. From startup.el:
(let ((dn (daemonp)))
(when dn
(when (stringp dn) (setq server-name dn))
(server-start)
(if server-process
(daemon-initialized)
(if (stringp dn)
(message
"Unable to start daemon: Emacs server named %S already running"
server-name)
(message "Unable to start the daemon.\nAnother instance of Emacs is running the server, either as daemon or interactively.\nYou can use emacsclient to connect to that Emacs process."))
(kill-emacs 1))))
So the problem seems to be that somehow server-start succeeds to leave
a non-nil server-process variable behind, although testing that is the
documented way of telling whether server is running.
So what is the value of server-process in your scenario?
next prev parent reply other threads:[~2024-01-29 17:11 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-29 16:54 bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails Spencer Baugh
2024-01-29 17:11 ` Eli Zaretskii [this message]
2024-01-29 17:18 ` Eli Zaretskii
2024-01-29 17:32 ` Spencer Baugh
2024-01-29 17:44 ` Eli Zaretskii
2024-01-29 18:13 ` Spencer Baugh
2024-01-29 19:12 ` Eli Zaretskii
2024-01-29 20:28 ` Spencer Baugh
2024-01-30 12:08 ` Eli Zaretskii
2024-02-10 19:50 ` sbaugh
2024-02-10 20:05 ` Eli Zaretskii
2024-02-10 23:23 ` sbaugh
2024-02-11 7:24 ` Eli Zaretskii
2024-02-12 22:10 ` Spencer Baugh
2024-02-13 12:35 ` Eli Zaretskii
2024-02-13 17:37 ` Spencer Baugh
2024-02-13 17:49 ` Eli Zaretskii
2024-02-13 18:04 ` Spencer Baugh
2024-02-13 19:46 ` Eli Zaretskii
2024-02-13 20:02 ` Spencer Baugh
2024-02-13 20:04 ` Eli Zaretskii
2024-02-13 20:20 ` Spencer Baugh
2024-02-14 14:23 ` Eli Zaretskii
2024-02-14 16:11 ` Spencer Baugh
2024-02-24 9:20 ` Eli Zaretskii
2024-02-13 13:02 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-13 21:30 ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
[not found] ` <875xys127y.fsf@>
2024-02-14 14:35 ` Eli Zaretskii
2024-02-14 15:10 ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
[not found] ` <87plwzytcg.fsf@>
2024-02-14 15:31 ` Eli Zaretskii
2024-02-14 17:40 ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86y1c82hfb.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=68799@debbugs.gnu.org \
--cc=sbaugh@janestreet.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).