From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: sbaugh@catern.com Newsgroups: gmane.emacs.bugs Subject: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails Date: Sat, 10 Feb 2024 19:50:20 +0000 (UTC) Message-ID: <875xywp08p.fsf@catern.com> References: <86y1c82hfb.fsf@gnu.org> <86wmrs2h41.fsf@gnu.org> <86v87c2fw4.fsf@gnu.org> <86sf2g2btj.fsf@gnu.org> <86r0hz2fcz.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1741"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 68799@debbugs.gnu.org, Spencer Baugh To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 10 21:11:13 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 1rYtgt-0000Gw-WA for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 10 Feb 2024 21:11:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rYtgW-0001qy-8b; Sat, 10 Feb 2024 15:10: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 1rYtgU-0001qf-JL for bug-gnu-emacs@gnu.org; Sat, 10 Feb 2024 15:10: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 1rYtgU-0006R8-AV for bug-gnu-emacs@gnu.org; Sat, 10 Feb 2024 15:10:46 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rYtgj-0007Kg-W2 for bug-gnu-emacs@gnu.org; Sat, 10 Feb 2024 15:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: sbaugh@catern.com Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Feb 2024 20:11: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.170759581728054 (code B ref 68799); Sat, 10 Feb 2024 20:11:01 +0000 Original-Received: (at 68799) by debbugs.gnu.org; 10 Feb 2024 20:10:17 +0000 Original-Received: from localhost ([127.0.0.1]:37964 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYtg0-0007IL-8i for submit@debbugs.gnu.org; Sat, 10 Feb 2024 15:10:17 -0500 Original-Received: from s.wrqvwxzv.outbound-mail.sendgrid.net ([149.72.154.232]:3764) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYtN4-0006K4-GZ for 68799@debbugs.gnu.org; Sat, 10 Feb 2024 14:50:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=from:subject:in-reply-to:references:mime-version:to:cc:content-type: content-transfer-encoding:cc:content-type:from:subject:to; s=s1; bh=e1+zApaftJd5N+XlqER1KEQcVU4VfzB27ZEeIAY7Su4=; b=PVFKUhB6cXcX1vs/Mf7qncUTjaZhG6brNN9HgXy12S5D3/3Hwpf8XUxpmx0Jo0aJWfkQ po+2z5WU+SydTdrmr6rgO0aDI1KrteArWQtZ/km/6Fk6ibloGKnFrufYUHoRB9EfFzseht UWhQBtQEOx0VgJdTTjbjbfaQxJkSpzqXP/soab1WMPdLcuL9OPphZABkOV0e7choKrszG/ ar/WFsAwfQFPeyNBk/ideWQGEN+djzJwv+yEaPhsmZeqlcrE/wZqohbSD5bIOijJBfe0Dq ipGMbk5QVKGjlN8VY7DZyhpn65+W+x0Uk95KzGeuBQ6HeD06XAWFDmxHn0ps9b5A== Original-Received: by recvd-ffdf554ff-45rqw with SMTP id recvd-ffdf554ff-45rqw-1-65C7D37C-A 2024-02-10 19:50:20.652266668 +0000 UTC m=+687948.044920535 Original-Received: from earth.catern.com (unknown) by geopod-ismtpd-canary-0 (SG) with ESMTP id Tt-0o8EyTC-U4t0XVH1Zrw Sat, 10 Feb 2024 19:50:20.576 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=74.101.51.129; helo=localhost; envelope-from=sbaugh@catern.com; receiver=gnu.org Original-Received: from localhost (unknown [74.101.51.129]) by earth.catern.com (Postfix) with ESMTPSA id 2F4FA62534; Sat, 10 Feb 2024 19:50:31 +0000 (UTC) In-Reply-To: <86r0hz2fcz.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 30 Jan 2024 14:08:28 +0200") X-SG-EID: ZgbRq7gjGrt0q/Pjvxk7wM0yQFRdOkTJAtEbkjCkHbK+4dOUKkHTveat1CreEVPWDlkxv5gcE5Q4y4eamRrhiq5wzye5im+CGr/WpCNO1cYpM7hXVnKibZGgrCEjOW1PJ/j3u8n8d8ME8KnUw+vlbSYE4RhjeMHvTYEme9ivC0NOoKASRPRe56PBMZO7XBGat6BBCMubCC4ykpVhlWZcYw== X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== 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:279795 Archived-At: Eli Zaretskii writes: >> From: Spencer Baugh >> Cc: 68799@debbugs.gnu.org >> Date: Mon, 29 Jan 2024 15:28:47 -0500 >> >> >> --- a/lisp/startup.el >> >> +++ b/lisp/startup.el >> >> @@ -1627,7 +1627,11 @@ command-line >> >> (let ((dn (daemonp))) >> >> (when dn >> >> (when (stringp dn) (setq server-name dn)) >> >> - (server-start) >> >> + (condition-case err >> >> + (server-start) >> >> + (error >> >> + (message "%s" (error-message-string err)) >> >> + (kill-emacs 1))) >> > >> > Thanks, this needs a comment explaining why we need condition-case and >> > where does error-message-string come from. >> >> Actually, on second thought, we could fail anywhere in startup.el, not >> just in server-start. So should we actually have a wrapper around all >> of normal-top-level which detects an error at startup in a daemon? > > I'd prefer to handle each specific problem specially, to make sure the > error message is self-explanatory. Also, if the error happens after > the server has been started, there's no reason to forcibly exit. > > So I think we should for now solve this particular issue, and not try > generalizing too much. To be clear, right now any error anywhere in command-line causes "emacs --fg-daemon" and "emacs --bg-daemon" to hang indefinitely, without printing an error, with no way to ever interact with the Emacs process. This error can come from any code, so if we have *any* bugs anywhere in code called from command-line, it will cause Emacs to enter this state. We can add good error messages for individual classes of error, but we should also have a catch-all check to make sure that Emacs doesn't enter this broken state if we (or the user) write code which contains a bug. I have concrete reasons to want this: I think there's a bug in command-line in trunk which some of my users using emacs --daemon have run into. But I have zero information about what caused the bug, because Emacs just hangs without printing any error message in this case. To allow users to report bugs that are at all useful, we should at least print the error that occurred, even if we don't kill Emacs.