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: Mon, 12 Feb 2024 17:10:34 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20378"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Stefan Monnier , Jason Rumney To: 68799@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 12 23:12:00 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 1rZeWu-00054K-9o for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 12 Feb 2024 23:12:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rZeWh-0001KI-Vu; Mon, 12 Feb 2024 17:11:48 -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 1rZeWg-0001Jr-8j for bug-gnu-emacs@gnu.org; Mon, 12 Feb 2024 17:11:46 -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 1rZeWf-0008OQ-W2 for bug-gnu-emacs@gnu.org; Mon, 12 Feb 2024 17:11:46 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rZeWw-0004qQ-5E for bug-gnu-emacs@gnu.org; Mon, 12 Feb 2024 17:12: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: Mon, 12 Feb 2024 22:12: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.170777587516579 (code B ref 68799); Mon, 12 Feb 2024 22:12:02 +0000 Original-Received: (at 68799) by debbugs.gnu.org; 12 Feb 2024 22:11:15 +0000 Original-Received: from localhost ([127.0.0.1]:34538 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZeWA-0004JJ-9m for submit@debbugs.gnu.org; Mon, 12 Feb 2024 17:11:14 -0500 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]:49867) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZeVt-0004HZ-G8 for 68799@debbugs.gnu.org; Mon, 12 Feb 2024 17:11:12 -0500 In-Reply-To: (Spencer Baugh's message of "Mon, 29 Jan 2024 11:54:21 -0500") DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1707775835; bh=wtjE8h0bgRp+aMxpqeR4YOP7TlicaoVObYIoG8Js8zs=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=CqtecnOVKhTouLnjI4beZgZmppvw/fyS3eOrBuE2tjUtzeu14/YDADcNpa7Qcnh94 KlLlKM2K2hxNNl43Hwddck/UAb95lO6ngGWzGU3aAt4rlCVVfLOCfAJhtRadpEW4vL GjoCLyVdJbpHi6ajSr1kFnRiHGn5a6XUX/51Z8/pWVAHBkYEFvNqZG++y7G/AOA/vv 9MGg2/ZODjzcpVl78z40wYW2jCjlGOYhWabmIwyeiQdauw6SPp7ytFdCWudcKK05gE nKRu2doflnzHpfPuvgdXCQoE+ca1PGO7ucxUW4LsP6x4Jv8AlQLDh60XYKjsL+6xGL cQYll6qd/dfmA== 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:279932 Archived-At: Spencer Baugh writes: > 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. Okay, I found what one might call the root cause, the following code and comment. Adding Stefan and Jason to CC as the original authors. /* The initial frame is a special non-displaying frame. It will be current in daemon mode when there are no frames to display, and in non-daemon mode before the real frame has finished initializing. If an error is thrown in the latter case while creating the frame, then the frame will never be displayed, so the safest thing to do is write to stderr and quit. In daemon mode, there are many other potential errors that do not prevent frames from being created, so continuing as normal is better in that case. */ || (!IS_DAEMON && FRAME_INITIAL_P (sf)) The comment is mostly sensible: we should exit while initializing, and shouldn't exit while in the steady state of daemon mode. However, it doesn't handle the case when Emacs is initializing *and* in daemon mode. In that case, an error will prevent frames from being created, just like in non-daemon mode. So this check really wants to be something more like: || ( IS_DAEMON && [something to check if Emacs is starting up]) || (!IS_DAEMON && FRAME_INITIAL_P (sf)) Not sure what [something to check if Emacs is starting up] should be though. Maybe it should check that server-process is non-nil and alive? That would be pretty nice, because then an error which stops the server would cause the Emacs daemon to log the error to stderr - and otherwise there's no way to get the error message from such an error.