From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails Date: Mon, 29 Jan 2024 19:11:36 +0200 Message-ID: <86y1c82hfb.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36252"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68799@debbugs.gnu.org To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 29 18:12:06 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 1rUVAz-0009BW-VU for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 29 Jan 2024 18:12:06 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUVAp-0003sB-De; Mon, 29 Jan 2024 12:11:55 -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 1rUVAn-0003rz-Rt for bug-gnu-emacs@gnu.org; Mon, 29 Jan 2024 12:11:54 -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 1rUVAn-00017Y-Jc for bug-gnu-emacs@gnu.org; Mon, 29 Jan 2024 12:11:53 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rUVAv-0004aa-Ow for bug-gnu-emacs@gnu.org; Mon, 29 Jan 2024 12:12:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 29 Jan 2024 17:12:01 +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.170654831917631 (code B ref 68799); Mon, 29 Jan 2024 17:12:01 +0000 Original-Received: (at 68799) by debbugs.gnu.org; 29 Jan 2024 17:11:59 +0000 Original-Received: from localhost ([127.0.0.1]:33331 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUVAs-0004aI-HK for submit@debbugs.gnu.org; Mon, 29 Jan 2024 12:11:58 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58598) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUVAp-0004a2-AK for 68799@debbugs.gnu.org; Mon, 29 Jan 2024 12:11:57 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rUVAb-00016U-4D; Mon, 29 Jan 2024 12:11:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=XnP6TQWH9mTiSQHets5xna0QnUum0grAv0fjKUuo3+4=; b=Zvl1oXZqvKyM 3oYfcrCyWSgaehGQeqkcojDvcEU5cJ3Nk1sqhZOHKJCXwtArjC3moF7mswyw94uw5g53549ZU16f6 AhGnUdpianXr+vaPphT0Q7tGVBct3N7HFK6DBbKtwBq4qGE12gXWUnCs1IgW9weOjk0gX7XxI5I0a 2bTFpsk2BRV+MMkfL4nf/DaglKwfGb9aFhyFYS8BktV2qPNr0ZpLahClyaTBhe+hrK5HX7bDo1hc1 cCIlk/6uZtagsVRx4ywXsHD9FI5OyzxsLAj1vEk1Wjn5rWE0iL7CJ7aSc33KDOVj80DDX4tOJ1QaP jMEt8SaJisHA4RRmXvk/fA==; In-Reply-To: (message from Spencer Baugh on Mon, 29 Jan 2024 11:54:21 -0500) 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:279134 Archived-At: > From: Spencer Baugh > 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?