From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs Subject: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails Date: Tue, 13 Feb 2024 15:20:21 -0500 Message-ID: References: <865xysr17s.fsf@gnu.org> <86mss4p83n.fsf@gnu.org> <86jzn8p2px.fsf@gnu.org> <86frxwp1uy.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9899"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 68799@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 13 21:20:56 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rZzGx-0002Ib-RI for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 13 Feb 2024 21:20:55 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rZzGr-0004cu-7s; Tue, 13 Feb 2024 15:20:49 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rZzGm-0004Xs-UB for bug-gnu-emacs@gnu.org; Tue, 13 Feb 2024 15:20:44 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rZzGm-0005rF-Ma for bug-gnu-emacs@gnu.org; Tue, 13 Feb 2024 15:20:44 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rZzH4-0005tF-8I for bug-gnu-emacs@gnu.org; Tue, 13 Feb 2024 15:21:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Feb 2024 20:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68799 X-GNU-PR-Package: emacs Original-Received: via spool by 68799-submit@debbugs.gnu.org id=B68799.170785564722609 (code B ref 68799); Tue, 13 Feb 2024 20:21:02 +0000 Original-Received: (at 68799) by debbugs.gnu.org; 13 Feb 2024 20:20:47 +0000 Original-Received: from localhost ([127.0.0.1]:47712 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZzGo-0005sb-QH for submit@debbugs.gnu.org; Tue, 13 Feb 2024 15:20:47 -0500 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]:45185) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZzGm-0005sN-L3 for 68799@debbugs.gnu.org; Tue, 13 Feb 2024 15:20:45 -0500 In-Reply-To: <86frxwp1uy.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 13 Feb 2024 22:04:37 +0200") DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1707855621; bh=l1/0pe30W2RD0xVdZckqlV7Mdg2cEBSU6lSakrS9yIk=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=WG6U1y0vSdj3x6hKWmAXf/M8WiFkxx22lqeiIHciYtWCqeOXxM6DvMt1/t3h1mpne U3WRdJNWK5DQhR3P+9EZhGWZrqo43Yur/ujtJyut8PF0VVfneHHJvXII3y9mvoAWkf 8BLOuWl9SF3EcudKLOe91sZMw/DEbVZOruIJF8RBcFlM8XgtLsRpI+hDrQqkBZd1hh +QE3lIn+6YgTu2M7R9vVGb5jpN5EjvdRTq6AKhnICdNmfLVUZ2v9u4E/gLeiXE4tks hbAYMDLpga6QMeE6wfN0nudpggQ8iGJH0xkvmW0059+MwEPVDkBJahtfTg/L21Pn3R NGc/tV92ZByUw== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:279981 Archived-At: Eli Zaretskii writes: >> From: Spencer Baugh >> Cc: 68799@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org >> Date: Tue, 13 Feb 2024 15:02:00 -0500 >>=20 >> > 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. >>=20 >> 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=3D/tmp/foo Starting Emacs daemon. =E2=80=98/tmp=E2=80=99 is not a safe directory because it is not owned by y= ou (owner =3D root (0)) $=20 (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=3D/tmp/foo Starting Emacs daemon. Unable to start daemon: =E2=80=98/tmp=E2=80=99 is not a safe directory beca= use it is not owned by you (owner =3D root (0)) $=20 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 e= rr)))) (if server-process (daemon-initialized) (if (stringp dn)