all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Spencer Baugh <sbaugh@janestreet.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 68799@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org
Subject: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails
Date: Tue, 13 Feb 2024 15:20:21 -0500	[thread overview]
Message-ID: <ierh6icazga.fsf@janestreet.com> (raw)
In-Reply-To: <86frxwp1uy.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 13 Feb 2024 22:04:37 +0200")

Eli Zaretskii <eliz@gnu.org> writes:
>> From: Spencer Baugh <sbaugh@janestreet.com>
>> Cc: 68799@debbugs.gnu.org,  monnier@iro.umontreal.ca,  jasonr@gnu.org
>> Date: Tue, 13 Feb 2024 15:02:00 -0500
>> 
>> > I think your patch will prevent us from doing that because the code
>> > which you suggest to patch with DAEMON_RUNNING will kill Emacs before
>> > startup.el gets the chance to show the error message, because
>> > daemon-initialized has not yet been run by that time.
>> 
>> Nope, it won't prevent us from doing that.  My patch affects only
>> *uncaught* errors, and improves behavior when errors are uncaught.  The
>> separate change we will make to the code you posted is to *catch more
>> errors*.  A change to the behavior for uncaught errors doesn't interfere
>> with us deciding to catch more errors.  Defining an explicit error
>> handler, of course, completely overrides the default handle for uncaught
>> errors.  So they're totally separate patches.
>
> Then let's see them together, so we understand what happens in each
> and every case.  This bug started from a silent failure to start the
> server, so its solution should solve at least that.

To be clear, the patch I posted which checks DAEMON_RUNNING *does* solve
that.

$ ./src/emacs -Q --fg-daemon=/tmp/foo
Starting Emacs daemon.
‘/tmp’ is not a safe directory because it is not owned by you (owner = root (0))
$ 

(which previously would have hung)

The issue now is solely that the printed error message is maybe not
informative enough.

So how about the following diff, which changes the output to:

$ ./src/emacs -Q --fg-daemon=/tmp/foo
Starting Emacs daemon.
Unable to start daemon: ‘/tmp’ is not a safe directory because it is not owned by you (owner = root (0))
$ 

diff --git a/lisp/startup.el b/lisp/startup.el
index 773765a4b97..d1420a3f9c5 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1627,7 +1627,9 @@ command-line
   (let ((dn (daemonp)))
     (when dn
       (when (stringp dn) (setq server-name dn))
-      (server-start)
+      (condition-case err
+          (server-start)
+        (error (error "Unable to start daemon: %s" (error-message-string err))))
       (if server-process
 	  (daemon-initialized)
 	(if (stringp dn)





  reply	other threads:[~2024-02-13 20:20 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
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 [this message]
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ierh6icazga.fsf@janestreet.com \
    --to=sbaugh@janestreet.com \
    --cc=68799@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=jasonr@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 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.