From unknown Fri Jun 20 07:19:22 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#68799 <68799@debbugs.gnu.org> To: bug#68799 <68799@debbugs.gnu.org> Subject: Status: 30.0.50; emacs --fg-daemon fails silently if server-start fails Reply-To: bug#68799 <68799@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:19:22 +0000 retitle 68799 30.0.50; emacs --fg-daemon fails silently if server-start fai= ls reassign 68799 emacs submitter 68799 Spencer Baugh severity 68799 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 29 11:54:47 2024 Received: (at submit) by debbugs.gnu.org; 29 Jan 2024 16:54:47 +0000 Received: from localhost ([127.0.0.1]:33323 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUUuE-0004A7-IP for submit@debbugs.gnu.org; Mon, 29 Jan 2024 11:54:47 -0500 Received: from lists.gnu.org ([2001:470:142::17]:42770) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUUuC-00049p-Jx for submit@debbugs.gnu.org; Mon, 29 Jan 2024 11:54:45 -0500 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 1rUUtu-0003jW-Pr for bug-gnu-emacs@gnu.org; Mon, 29 Jan 2024 11:54:28 -0500 Received: from mxout5.mail.janestreet.com ([64.215.233.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rUUts-0005tl-Lm for bug-gnu-emacs@gnu.org; Mon, 29 Jan 2024 11:54:26 -0500 From: Spencer Baugh To: bug-gnu-emacs@gnu.org Subject: 30.0.50; emacs --fg-daemon fails silently if server-start fails X-Debbugs-Cc: Date: Mon, 29 Jan 2024 11:54:21 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1706547262; bh=bEfkIvBh6QOyvSbF8An0Ndy8QCCQSUZDyCw81DyIAFQ=; h=From:To:Subject:Date; b=vKZXsv19lhq9mgFg3XZR4uUnUHv0o1kSV1vGA9pdg2j8FrMD0cOd/ikjOjSd+3yly xevVb1CROjJhTmD5yXDdptYG4M7pavHjX2gKa+KNm84aqvrktI+dNHVedlpzYFzLy5 SfUZvCjj2/fW81VryZUEYK1WK6xyfQ2AcDZaoruI0d1gP7T8r7ELuhc+/K6dts7unW BTQdoHvni9wn9AJgmCyifr9E92jaDHt/ZJahCRNJLuG1DLZmj3Yi3yhNvpJ5blju5E dX8SO3vxi4xli/ZhwW+kuQ+TnDWVgnYPz1a2ilcvqixLi2spwbNJRJztBRFanCwmW1 95Af7pDH1t6Xw== Received-SPF: pass client-ip=64.215.233.18; envelope-from=sbaugh@janestreet.com; helo=mxout5.mail.janestreet.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) 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. In GNU Emacs 30.0.50 (build 22, x86_64-pc-linux-gnu, X toolkit, cairo version 1.15.12, Xaw scroll bars) of 2024-01-29 built on igm-qws-u22796a Repository revision: cbc8bdc1386a4bc9c420d8ab06b844c6f6928c35 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12011000 System Description: Rocky Linux 8.9 (Green Obsidian) Configured using: 'configure -C 'CFLAGS=-O0 -g3' --with-gif=ifavailable --with-x-toolkit=lucid' Configured features: CAIRO DBUS FREETYPE GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XINPUT2 XPM LUCID ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date subr-x mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify dynamic-setting system-font-setting font-render-setting cairo x-toolkit xinput2 x multi-tty move-toolbar make-network-process emacs) Memory information: ((conses 16 64886 10659) (symbols 48 9545 0) (strings 32 22761 1636) (string-bytes 1 676280) (vectors 16 9262) (vector-slots 8 111310 9095) (floats 8 40 17) (intervals 56 262 0) (buffers 976 10)) From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 29 12:11:58 2024 Received: (at 68799) by debbugs.gnu.org; 29 Jan 2024 17:11:59 +0000 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 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 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==; Date: Mon, 29 Jan 2024 19:11:36 +0200 Message-Id: <86y1c82hfb.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (message from Spencer Baugh on Mon, 29 Jan 2024 11:54:21 -0500) Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > 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? From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 29 12:18:40 2024 Received: (at 68799) by debbugs.gnu.org; 29 Jan 2024 17:18:40 +0000 Received: from localhost ([127.0.0.1]:33339 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUVHL-0004ko-On for submit@debbugs.gnu.org; Mon, 29 Jan 2024 12:18:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44370) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUVHK-0004ka-FC for 68799@debbugs.gnu.org; Mon, 29 Jan 2024 12:18:39 -0500 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 1rUVH6-0002HO-J8; Mon, 29 Jan 2024 12:18:24 -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=1cKu53qXw3tk29FjOs5rRyxjZhS/Ly8auKf8U9OGe9k=; b=Ka1WJy8fcFoY NrAJvuaobp59dlWgm+pkwRkkbpJsQyPsQnQGT5xHxckK3Y83Sw6FZ4xzQhT0cOSkYoUSPRrtM5qHr 6pnSGo06TaDg3ZVVszX+MMZXt8ngXBoUopEGft8AswN4Z3CgeT9sE3dLIFH+2XSjB379kGV2ys98l nZvGJ5U5B5uW5VZHb1AJSHz7fL3EXY1fl6/gIp7jcnME1OQFGsOZ0AT60Vf0julTyUIC2PzUORajo Ft7v01U2kcmmEHWpNIdHwL7xsC6QUAXKWCGFTR2octZsa+6661/9WjvK667CAazx8au0dC4vgTPZV kx4XRvE61y5ik+REDp/jrA==; Date: Mon, 29 Jan 2024 19:18:22 +0200 Message-Id: <86wmrs2h41.fsf@gnu.org> From: Eli Zaretskii To: sbaugh@janestreet.com In-Reply-To: <86y1c82hfb.fsf@gnu.org> (message from Eli Zaretskii on Mon, 29 Jan 2024 19:11:36 +0200) Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails References: <86y1c82hfb.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: 68799@debbugs.gnu.org > Date: Mon, 29 Jan 2024 19:11:36 +0200 > From: Eli Zaretskii > > 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. Or maybe server-start signals an error, and then the code which shows an error message and shuts down Emacs doesn't get run? From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 29 12:32:16 2024 Received: (at 68799) by debbugs.gnu.org; 29 Jan 2024 17:32:16 +0000 Received: from localhost ([127.0.0.1]:33356 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUVUW-00059j-4Y for submit@debbugs.gnu.org; Mon, 29 Jan 2024 12:32:16 -0500 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:56789) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUVUU-00059K-3r for 68799@debbugs.gnu.org; Mon, 29 Jan 2024 12:32:15 -0500 From: Spencer Baugh To: Eli Zaretskii Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails In-Reply-To: <86wmrs2h41.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 29 Jan 2024 19:18:22 +0200") References: <86y1c82hfb.fsf@gnu.org> <86wmrs2h41.fsf@gnu.org> Date: Mon, 29 Jan 2024 12:32:00 -0500 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1706549520; bh=wnoC2Ra6lYYduzeuRHdG5ELReqtnd3kZvIUhFoBfxkE=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=YBmDm5EEtBK5kPfG+Bc6OyrLo5kSdX6Qvil00YnTUpOrO3ByYfbIR3KDK5pLbTs9n 7ycu/WS/2yH6UkfbS4vi8o2KS9ouiHjTUoIurg6Wa+rwmXkRDgafLjgJ5vTeBBJ84z ENAEXJzh34ozaDZM/siqJveuKNvf70Q8lL8nyQf9QgaQ7VqDsC09Nm7JKb+FgsMNYM 0DgLAKix09lVMrXJbz/LTTYecWhNgf9fUK+hb9ElmNfehWKhI94mpBVj6M9D8Znlqe ERvp3kkHhy9hsn4TATWEl1aeCrY7KdPN35LR1SnL5+13teEFwMOYKmNtNWNgdnsn0I fuA0WU3oPRrzA== X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> Cc: 68799@debbugs.gnu.org >> Date: Mon, 29 Jan 2024 19:11:36 +0200 >> From: Eli Zaretskii >> >> 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. > > Or maybe server-start signals an error, and then the code which shows > an error message and shuts down Emacs doesn't get run? Yes, that's exactly what happens. So should we wrap a condition-case around server-start, I suppose? From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 29 12:45:02 2024 Received: (at 68799) by debbugs.gnu.org; 29 Jan 2024 17:45:02 +0000 Received: from localhost ([127.0.0.1]:33380 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUVgr-0005fX-EB for submit@debbugs.gnu.org; Mon, 29 Jan 2024 12:45:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51654) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUVgp-0005fA-9A for 68799@debbugs.gnu.org; Mon, 29 Jan 2024 12:45:00 -0500 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 1rUVgb-0000Yw-4X; Mon, 29 Jan 2024 12:44:45 -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=x0Dwkkko2vBcb3z5GCfr9VgaWcDeNA7kfkB9qBok0vo=; b=pU7/K/oWVapp LJrs0LX50TE06GtOxV18eJUKZjQ70WABOii3gypQrTJHjU0ya/IHfahUxpVZrf4zjhKWX9rzsyIP0 ByTzsPKzq9A8/UhyU3ttAzgUFnSqDlKezeiZvsAQ5aNVjK6HLO2d1tA/RBb3A2uSLIhN0w/f48jFw 7xcsFdmQ+B+SnRvavend9HHA+im63INc84hM/lMPwnn6jCECyzkYsgC8YQz0mgSDo+OEmoIxMVq/o bdq4KC6BLTMp0hoVDSLmjHxrC6WZ1/wAxitXLX91StXNzYdfLZqPh4jsxYw9XCT8j1NaVbshswYxy lXLdJ/ZzFoxczRmfr+PRIg==; Date: Mon, 29 Jan 2024 19:44:43 +0200 Message-Id: <86v87c2fw4.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (message from Spencer Baugh on Mon, 29 Jan 2024 12:32:00 -0500) Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails References: <86y1c82hfb.fsf@gnu.org> <86wmrs2h41.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Spencer Baugh > Cc: 68799@debbugs.gnu.org > Date: Mon, 29 Jan 2024 12:32:00 -0500 > > Eli Zaretskii writes: > > >> 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. > > > > Or maybe server-start signals an error, and then the code which shows > > an error message and shuts down Emacs doesn't get run? > > Yes, that's exactly what happens. > > So should we wrap a condition-case around server-start, I suppose? Probably. But perhaps we should also modify server-start so that, when it is called from a daemon, it signals in this case a distinct error, which startup.el could then detect and display a friendly error message. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 29 13:13:59 2024 Received: (at 68799) by debbugs.gnu.org; 29 Jan 2024 18:13:59 +0000 Received: from localhost ([127.0.0.1]:33426 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUW8s-0006Xm-Mo for submit@debbugs.gnu.org; Mon, 29 Jan 2024 13:13:59 -0500 Received: from mxout6.mail.janestreet.com ([64.215.233.21]:49449) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUW8q-0006XZ-KS for 68799@debbugs.gnu.org; Mon, 29 Jan 2024 13:13:57 -0500 From: Spencer Baugh To: Eli Zaretskii Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails In-Reply-To: <86v87c2fw4.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 29 Jan 2024 19:44:43 +0200") References: <86y1c82hfb.fsf@gnu.org> <86wmrs2h41.fsf@gnu.org> <86v87c2fw4.fsf@gnu.org> Date: Mon, 29 Jan 2024 13:13:42 -0500 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1706552022; bh=2vLqDTdkLeK69fGIe7OmvGr9s84FMSxttZP5oxEEcn4=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=lLGnovzVluUjI2tc1wsEojhFfdpGfqGaUdBU4+O9uimm/1AL2J34ajGiCpXyUoqUY pX5EY7F3yLb+Xhj78UJSqg8DJaEFu7deg/5DCo5GNGIPlAWKaQ5KAuuomgCiWFZjtU L7z2suOV50XgL1bPMSIgNmKZ6Yb+5ZXJjmQ/rel4LK4HTCjTX1L1VkkAlhN3+/EclY Tvxp59iFCfvkVtBHR2es7BdWg+1ny3ydwYDAhowIHE1Alv+11PVTO2lR/6Jc2wc2Rl GafU5zS4gSMVmz8QsYTXOre7rOpEC55ylpswqURfQBGyOLOkJI1P2T9Pgt4EsKxbvf uLz9lLKzVP0OQ== X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Spencer Baugh >> Cc: 68799@debbugs.gnu.org >> Date: Mon, 29 Jan 2024 12:32:00 -0500 >> >> Eli Zaretskii writes: >> >> >> 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. >> > >> > Or maybe server-start signals an error, and then the code which shows >> > an error message and shuts down Emacs doesn't get run? >> >> Yes, that's exactly what happens. >> >> So should we wrap a condition-case around server-start, I suppose? > > Probably. But perhaps we should also modify server-start so that, > when it is called from a daemon, it signals in this case a distinct > error, which startup.el could then detect and display a friendly error > message. Actually, it seems that main() already does a fputs ("Error: server did not start correctly\n", stderr); if the server process exits non-zero. So we already get a nice: Starting Emacs daemon. Creating directory: Permission denied, /nonexistent Error: server did not start correctly So I think the below patch suffices. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Message-when-server-start-errors-in-emacs-daemon.patch >From 2a6f039663a678d0fcae47318011fbb5d8bb5f1c Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Mon, 29 Jan 2024 13:11:47 -0500 Subject: [PATCH] Message when server-start errors in emacs --daemon Previously, if a user invoked emacs --daemon and then server-start failed, there would be no indication of this and emacs would simply hang. Now, something like emacs --daemon=/nonexistent/sock results in: $ emacs --fg-daemon=/nonexistent/sock Starting Emacs daemon. Creating directory: Permission denied, /nonexistent $ emacs --daemon=/nonexistent/sock Starting Emacs daemon. Creating directory: Permission denied, /nonexistent Error: server did not start correctly and Emacs exits non-zero. * lisp/startup.el (command-line): Catch errors from server-start, and message and exit. (bug#68799) --- lisp/startup.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/startup.el b/lisp/startup.el index 23937055f30..ae465b5bb07 100644 --- 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))) (if server-process (daemon-initialized) (if (stringp dn) -- 2.39.3 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 29 14:13:00 2024 Received: (at 68799) by debbugs.gnu.org; 29 Jan 2024 19:13:00 +0000 Received: from localhost ([127.0.0.1]:33484 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUX40-0002Ll-7z for submit@debbugs.gnu.org; Mon, 29 Jan 2024 14:13:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45450) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUX3x-0002LX-OF for 68799@debbugs.gnu.org; Mon, 29 Jan 2024 14:12:58 -0500 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 1rUX3j-00018W-Ln; Mon, 29 Jan 2024 14:12:43 -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=CNfnmcdRYDTN1HO5xVFBkDxHHD6P/Xa+M7TtJIBK/OU=; b=hoV9+S2ja6Fu PIIO6DozA2mrlRSXjGSwcN+aVaorG7+1wTO+C/f0cpOdmzTIbnNdKNA/MZOo2jMnb/BKHu3djj9QM im2mLrmdvXX7vAMzI1SkrPYnwd3Sx2XIyXSR1TVUAV4FPe4O0rt9soIDcRj7l3cYBH00Hyp8bj303 6VmNR35SpW9hm+LQI6k2gjvyc2ADf/XGu4bUXGkftjnE1c2xhdVEfAU6fMgpRu7cy9Z3o37zp0d1D l2qNHFrdEbB7bjGisF8IwauCB1SDzlxXstPvXx9Nft4csCG5pxUAxLavm+75ZbIYilwRqMyzG+MyI n4wTdLR4vN9pHJXTD7DgcA==; Date: Mon, 29 Jan 2024 21:12:40 +0200 Message-Id: <86sf2g2btj.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (message from Spencer Baugh on Mon, 29 Jan 2024 13:13:42 -0500) Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails References: <86y1c82hfb.fsf@gnu.org> <86wmrs2h41.fsf@gnu.org> <86v87c2fw4.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Spencer Baugh > Cc: 68799@debbugs.gnu.org > Date: Mon, 29 Jan 2024 13:13:42 -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. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 29 15:29:03 2024 Received: (at 68799) by debbugs.gnu.org; 29 Jan 2024 20:29:03 +0000 Received: from localhost ([127.0.0.1]:33572 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUYFa-0004N1-PJ for submit@debbugs.gnu.org; Mon, 29 Jan 2024 15:29:03 -0500 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:44627) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUYFZ-0004MY-96 for 68799@debbugs.gnu.org; Mon, 29 Jan 2024 15:29:01 -0500 From: Spencer Baugh To: Eli Zaretskii Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails In-Reply-To: <86sf2g2btj.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 29 Jan 2024 21:12:40 +0200") References: <86y1c82hfb.fsf@gnu.org> <86wmrs2h41.fsf@gnu.org> <86v87c2fw4.fsf@gnu.org> <86sf2g2btj.fsf@gnu.org> Date: Mon, 29 Jan 2024 15:28:47 -0500 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1706560127; bh=ExQyKctevVj7qUnHsRrSM4qgj+dBTltvLEP+ElSWrqo=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=cskk6hxshvErFcrK3e4SgiUtserDKqEf0nM95gEGz7bfuOVxI8Orm4KsJ66dU+gVN znfso2dAddE9+ewyTFqH3gkmI038JlHLtf6dxEY9BH2nAmarXVqgpWMlvuRh3eYnjA q1bxqF8xJTKM0wvVfGey/syt7zT5lSB/PA7tESNdmD2KM4fRNjq4jaCIHo6e+zTd9i caesaDWI4GEVkJR7F2WwKtf/ayloJV6f7XwhPtFkOdXttr4ERusbNvyr8S3w+B/w0w wPJirWRP6UCZ/0+lPz+dKXB0Sv2NSNdsSEKaqxLmYKly6fg0aLyFU+KOlkSFubM+CX 3yf/74K+GzGOg== X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Spencer Baugh >> Cc: 68799@debbugs.gnu.org >> Date: Mon, 29 Jan 2024 13:13:42 -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? For example, this will also fail to start the server and hang with no error message: emacs --eval '(error)' --daemon Likewise any errors raised in init.el will also just hang without starting the server, although that at least causes some logs to be printed. Maybe we should handle this in the C top_level_1, conditional on IS_DAEMON? From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 30 07:09:05 2024 Received: (at 68799) by debbugs.gnu.org; 30 Jan 2024 12:09:05 +0000 Received: from localhost ([127.0.0.1]:34496 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUmv5-0007N5-AP for submit@debbugs.gnu.org; Tue, 30 Jan 2024 07:09:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37470) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUmv3-0007Ms-A8 for 68799@debbugs.gnu.org; Tue, 30 Jan 2024 07:08:49 -0500 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 1rUmum-0004RV-P7; Tue, 30 Jan 2024 07:08:33 -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=40OQsoQY3Ov0QagZgsOjCkaciHXltmXK57XZBBpi3zo=; b=mj2cZMn80hDk 6h0YhPdULiHGdOmHSJczFGDpPp3kVBWWQma8bjhjXhbmi6imw4jcrSxLx26IZklt1bhA5LCagzH7R fciUqcFEULXnBoGwWv/hsC2/0KUnzSivBb2AtEMuWPwgy35VMTryLw2QwVf9F7zxMJ19Vm68C/tjJ ouifE4/t0TjPwylmeRK2C5qhybBtUh1V9Fi+GaEr/3inGbkFHTkwfNq2RLqhs0QyKAR5ShVMg5oV5 dAzbrIZTshVis3ZmHUCGPq3Kczla9J+kAB1SE/+hcKGXrJ1ZBkuaVQ9J9wGtiIPvO6pg7Qdgs9T79 vs+LacThBp/bChWtF1RLkg==; Date: Tue, 30 Jan 2024 14:08:28 +0200 Message-Id: <86r0hz2fcz.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (message from Spencer Baugh on Mon, 29 Jan 2024 15:28:47 -0500) Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails References: <86y1c82hfb.fsf@gnu.org> <86wmrs2h41.fsf@gnu.org> <86v87c2fw4.fsf@gnu.org> <86sf2g2btj.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > 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. From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 10 15:10:17 2024 Received: (at 68799) by debbugs.gnu.org; 10 Feb 2024 20:10:17 +0000 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 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== 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 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 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) From: sbaugh@catern.com Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails In-Reply-To: <86r0hz2fcz.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 30 Jan 2024 14:08:28 +0200") References: <86y1c82hfb.fsf@gnu.org> <86wmrs2h41.fsf@gnu.org> <86v87c2fw4.fsf@gnu.org> <86sf2g2btj.fsf@gnu.org> <86r0hz2fcz.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Sat, 10 Feb 2024 19:50:20 +0000 (UTC) Message-ID: <875xywp08p.fsf@catern.com> MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbK+4dOUKkHTveat1CreEV?= =?us-ascii?Q?PWDlkxv5gcE5Q4y4eamRrhiq5wzye5im+CGr=2FWp?= =?us-ascii?Q?CNO1cYpM7hXVnKibZGgrCEjOW1PJ=2Fj3u8n8d8ME?= =?us-ascii?Q?8KnUw+vlbSYE4RhjeMHvTYEme9ivC0NOoKASRPR?= =?us-ascii?Q?e56PBMZO7XBGat6BBCMubCC4ykpVhlWZcYw=3D=3D?= To: Eli Zaretskii X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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,1 [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [149.72.154.232 listed in wl.mailspike.net] 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org, Spencer Baugh X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) 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. From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 10 15:10:18 2024 Received: (at 68799) by debbugs.gnu.org; 10 Feb 2024 20:10:18 +0000 Received: from localhost ([127.0.0.1]:37967 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYtg1-0007IR-Ip for submit@debbugs.gnu.org; Sat, 10 Feb 2024 15:10:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34264) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYtcF-000750-2S for 68799@debbugs.gnu.org; Sat, 10 Feb 2024 15:06:24 -0500 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 1rYtbt-0005Y0-Ev; Sat, 10 Feb 2024 15:06:01 -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=hcsiEIAR7DLvbZywJMgIa5I8GElJxTiufEogL0wTf1Q=; b=PCZt8Lwh5KgO U4ldpGUJpvh/rNlj2Wh/378kCEPxqyxq4nAH1iEjbB1AqC0bnRKPLNS5WiIZOUBd/F5uBVT4f9+BD tBYOB9UWyM1nV11k7U5t+EqQn99/LxuCS6G7sPtBaalBOFYeiA0hBA5tzDpSjK6ExpiYROP0lBWw8 uXLo6AKVzCrviaSTan1h978Nkpqo+iHWVmtMr1qtNiN/oqcCj63pR1cM6s1RP+IT76647ENWbOeKC vhJFzhSSnCcC8BBkfxQqzCL8srCoC3069IckhQToLUVEGgEVrLMSmM0NebVkyArtSyE3MtvCRtAMj GfASf7dEe7A8h72YfLU3Rg==; Date: Sat, 10 Feb 2024 22:05:58 +0200 Message-Id: <868r3st789.fsf@gnu.org> From: Eli Zaretskii To: sbaugh@catern.com In-Reply-To: <875xywp08p.fsf@catern.com> (sbaugh@catern.com) Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails References: <86y1c82hfb.fsf@gnu.org> <86wmrs2h41.fsf@gnu.org> <86v87c2fw4.fsf@gnu.org> <86sf2g2btj.fsf@gnu.org> <86r0hz2fcz.fsf@gnu.org> <875xywp08p.fsf@catern.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org, sbaugh@janestreet.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: sbaugh@catern.com > Date: Sat, 10 Feb 2024 19:50:20 +0000 (UTC) > Cc: Spencer Baugh , 68799@debbugs.gnu.org > > Eli Zaretskii writes: > > >> > 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. That's not what you said before: you said "anywhere in startup.el", which is much more general. Now you are saying something different. What exactly is meant by "anywhere in command-line"? the function command-line in startup.el? or something else? > 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. Why would we assume that *any code* there will signal an error? That's like saying that Emacs is a useless program that always signals errors in random places. That's a non-starter here. > 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. There's no reason to have a catch-all check where no error is expected. Do you always wrap all of your code in condition-case and the likes? If not, why not? > 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. Then please debug that, and let's talk when you do have concrete data. > 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. Users aren't supposed to debug Emacs, it's the job of developers. And developers know how to run Emacs under a debugger and do any number of other debugging tricks. Injecting debugging code into Emacs just because some of your users did something wrong is not a good idea. Or maybe it is -- but we won't know until we understand what exactly goes wrong in those cases. From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 10 18:23:45 2024 Received: (at 68799) by debbugs.gnu.org; 10 Feb 2024 23:23:45 +0000 Received: from localhost ([127.0.0.1]:51364 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYwhF-000262-5X for submit@debbugs.gnu.org; Sat, 10 Feb 2024 18:23:45 -0500 Received: from s.wfbtzhsv.outbound-mail.sendgrid.net ([159.183.224.104]:3486) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYwhB-00025W-VE for 68799@debbugs.gnu.org; Sat, 10 Feb 2024 18:23: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=2dkwgEJIc1JKogXgf9kljwa2ATKoXNF4fskZC60aenA=; b=Ms6fl8WFL612j1AbuzqDnjeEqAqLfcYStA3OAJw8xqWUvvfX3kURzL30OwQND0f3+7jK ROZNLobNXB6/dRXJq4RU1XJfNPDBal1LeyuGU/ripYGPqhrX2rbNehMXzfNt9I6HxbF5zg npUWbSDpjVUK7JiUiMI3IfGqyPUNgesmvZYdsKh2vQtKCu3NiwqU0LJih09PpWbvgNsA78 pRaGAnvlHjB7oCj6v2t+P2rTK9mgfM0k/Tjtm0p+6BybQiAnn1BXXPD9pACQnTcHyghtFH xkANsfH/VbCN5NMhi9wQuGQ1Vxs/D19gMj5ztwwv2Bmmf46R5BP9YI/rvmSmvlCg== Received: by filterdrecv-58bfc74dd6-grnpr with SMTP id filterdrecv-58bfc74dd6-grnpr-1-65C80567-9 2024-02-10 23:23:19.572244206 +0000 UTC m=+1415182.492062421 Received: from earth.catern.com (unknown) by geopod-ismtpd-5 (SG) with ESMTP id l-VivqfmTNSnUjmJbh3nwA Sat, 10 Feb 2024 23:23:19.505 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=74.101.51.129; helo=localhost; envelope-from=sbaugh@catern.com; receiver=gnu.org Received: from localhost (unknown [74.101.51.129]) by earth.catern.com (Postfix) with ESMTPSA id B97DB62534; Sat, 10 Feb 2024 23:23:29 +0000 (UTC) From: sbaugh@catern.com Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails In-Reply-To: <868r3st789.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 10 Feb 2024 22:05:58 +0200") References: <86y1c82hfb.fsf@gnu.org> <86wmrs2h41.fsf@gnu.org> <86v87c2fw4.fsf@gnu.org> <86sf2g2btj.fsf@gnu.org> <86r0hz2fcz.fsf@gnu.org> <875xywp08p.fsf@catern.com> <868r3st789.fsf@gnu.org> Date: Sat, 10 Feb 2024 23:23:19 +0000 (UTC) Message-ID: <8734tzq4y6.fsf@catern.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbJCW+oxwTBGtV9Zic6d8v?= =?us-ascii?Q?POU3N+vCh993uQf1owIM5c25fDSOHJMDehTyzOb?= =?us-ascii?Q?WRvsbTHBIhd9gh+zqgOFr95EhkC8ISyRW3S=2Fjdy?= =?us-ascii?Q?7uwUUI9YUBMjUWbruOO6xhu9QpSynIaKsJSX4C+?= =?us-ascii?Q?8z1jlI4MgyvGOWgtmYhX6wsuxCeLgtede7A=3D=3D?= To: Eli Zaretskii X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org, sbaugh@janestreet.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: sbaugh@catern.com >> Date: Sat, 10 Feb 2024 19:50:20 +0000 (UTC) >> Cc: Spencer Baugh , 68799@debbugs.gnu.org >> >> Eli Zaretskii writes: >> >> >> > 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. > > That's not what you said before: you said "anywhere in startup.el", > which is much more general. Now you are saying something different. > > What exactly is meant by "anywhere in command-line"? the function > command-line in startup.el? or something else? The function command-line in startup.el. Or, more specifically: anywhere during the evaluation of the form in the variable top-level, which by default is (normal-top-level). (which calls (command-line)) >> 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. > > Why would we assume that *any code* there will signal an error? > That's like saying that Emacs is a useless program that always signals > errors in random places. That's a non-starter here. We aren't assuming this code in particular will signal an error. We are just make this code behave equivalently to other Emacs code, which, when it throws an error due to a bug, logs that error. >> 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. > > There's no reason to have a catch-all check where no error is > expected. Do you always wrap all of your code in condition-case and > the likes? If not, why not? The reason to have a catch-all is what I just said: if there's an error in this code, either caused by the user or from a bug in the code, it causes Emacs to silently hang without logging an error, providing absolutely no way for the user to know what's going wrong. You might as well ask why we have a condition-case wrapped around command_loop_1 which calls cmd_error, instead of just discarding the error and continuing. >> 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. > > Then please debug that, and let's talk when you do have concrete data. I can't debug that because I can't reproduce it and the failure case leaves no information behind. That's part of the point of why we should log on error. Your argument here justifies silencing all errors in Emacs and never writing them to *Messages*. That's obviously absurd... From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 11 02:25:02 2024 Received: (at 68799) by debbugs.gnu.org; 11 Feb 2024 07:25:02 +0000 Received: from localhost ([127.0.0.1]:55217 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZ4Cz-0002AN-Uf for submit@debbugs.gnu.org; Sun, 11 Feb 2024 02:25:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48464) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZ4Cx-00029g-Ml for 68799@debbugs.gnu.org; Sun, 11 Feb 2024 02:25:00 -0500 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 1rZ4Cb-0001kY-SC; Sun, 11 Feb 2024 02:24:37 -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=dLPwydTOzregVWzI86ugSnJuTTFaYsYPOrJZxnH+YRk=; b=j1gkPtTo+56T UTfZH4kWVC+AJO0NCd94NvXRG0+kshg7PCfBLBEnrhc6k38wM7ifsG0H2Les5q4/9ha7XCJ7a95ZW EZgbqszp2NEtIQB5hwUTkuiqHXT48XHc3I1nqHQQcXuMR0x77CptvsLQST6Vf12G5ndY/Y0xpvACQ eKYQIZQpWQzb5zqX6ejsJNMZE6IeHsInQmW4nNxS4d10bsdMhYs1DRDopr4BI+9IUAQdfOgSCb+RZ zSiPpYSLk2W3sIwXwEvMdY4YIcwuLk0f0/Prfgkkmoay58G0LmeBsyySrlLqrUi2gZFpINPdIomi9 Kef1MnU+yESSMCp3kZJZRA==; Date: Sun, 11 Feb 2024 09:24:36 +0200 Message-Id: <86zfw7sbt7.fsf@gnu.org> From: Eli Zaretskii To: sbaugh@catern.com In-Reply-To: <8734tzq4y6.fsf@catern.com> (sbaugh@catern.com) Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails References: <86y1c82hfb.fsf@gnu.org> <86wmrs2h41.fsf@gnu.org> <86v87c2fw4.fsf@gnu.org> <86sf2g2btj.fsf@gnu.org> <86r0hz2fcz.fsf@gnu.org> <875xywp08p.fsf@catern.com> <868r3st789.fsf@gnu.org> <8734tzq4y6.fsf@catern.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org, sbaugh@janestreet.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: sbaugh@catern.com > Date: Sat, 10 Feb 2024 23:23:19 +0000 (UTC) > Cc: 68799@debbugs.gnu.org, sbaugh@janestreet.com > > > What exactly is meant by "anywhere in command-line"? the function > > command-line in startup.el? or something else? > > The function command-line in startup.el. > > Or, more specifically: anywhere during the evaluation of the form in the > variable top-level, which by default is (normal-top-level). (which > calls (command-line)) Some of that code already detects errors and takes appropriate actions. I'm okay with augmenting the existing error-detecting code in startup.el with daemon-specific actions, if what we do now is not TRT for the daemon invocations. I'm also okay with identifying more places where error detection and recovery is needed, perhaps only in the daemon case. But that must be on a case by case basis, based on clear understanding what could be the reasons and the effects of those reasons. I'm not interested in "catch-all" dumb processing of startup errors without understanding them, because the recovery code will then not necessarily be correct and on target. > The reason to have a catch-all is what I just said: if there's an error > in this code, either caused by the user or from a bug in the code, it > causes Emacs to silently hang without logging an error, providing > absolutely no way for the user to know what's going wrong. Not true, at least not in all cases. Once again, the only way to make progress here that I agree to is one case at a time, based on understanding the possible reasons and on what we want Emacs (daemon or not) do in each case. > You might as well ask why we have a condition-case wrapped around > command_loop_1 which calls cmd_error, instead of just discarding the > error and continuing. The reason for doing it with command_loop_1 is well known, and is not really relevant to this discussion. > >> 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. > > > > Then please debug that, and let's talk when you do have concrete data. > > I can't debug that because I can't reproduce it and the failure case > leaves no information behind. That's part of the point of why we should > log on error. It's okay for you to add code locally to the relevant parts that would log the necessary information, so you can understand what happens. Please get back after you understand what went wrong, and we can then discuss whether such situations could happen with others, and whether and how to handle them. > Your argument here justifies silencing all errors in Emacs and never > writing them to *Messages*. That's obviously absurd... Yes, so let's not go "ad absurdum". From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 12 17:11:14 2024 Received: (at 68799) by debbugs.gnu.org; 12 Feb 2024 22:11:15 +0000 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 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 From: Spencer Baugh To: 68799@debbugs.gnu.org Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails In-Reply-To: (Spencer Baugh's message of "Mon, 29 Jan 2024 11:54:21 -0500") References: Date: Mon, 12 Feb 2024 17:10:34 -0500 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain 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-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68799 Cc: Stefan Monnier , Jason Rumney X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 13 07:40:16 2024 Received: (at 68799) by debbugs.gnu.org; 13 Feb 2024 12:40:16 +0000 Received: from localhost ([127.0.0.1]:42773 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZs59-0004YA-Ej for submit@debbugs.gnu.org; Tue, 13 Feb 2024 07:40:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57752) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZs15-0004QI-Au for 68799@debbugs.gnu.org; Tue, 13 Feb 2024 07:36:04 -0500 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 1rZs0h-0000fr-Cm; Tue, 13 Feb 2024 07:35:39 -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=NUpho1mTKC7WXqXw1bSJ6XNtHR9lSp+ThjuDFi/jmgU=; b=iSdkbJ0L4T/O X2jeUP5gvtkUMxIHT4ZoJQk9uaq873rtUnFE86H2kJq1iLd7RM2RTJb74JZOMNrZi1JfXxFX3U8YR OJ0CDWUSh6utZ1VvZH+tc70xnzFGUs3f1kRHy5epv1fCyGXipt6kO71wNEMb0lOiPovs3qhZrY8vY txvONU2irzF6ycajZ+Xpos/IQ81qTS1BoVUxHsuj5kFCzcdpCPqt4mbsRFRs4ZQf147Is/hDou0fo vI3OWnJ6vLThpNBEVahNUBcp3MlW1AcDnNTcUN/rguVMlJVPclI61MbHOY7H66c8JNRb5GoP2/Lrd bzPGCRt+GIW0R8m/f18z8Q==; Date: Tue, 13 Feb 2024 14:35:35 +0200 Message-Id: <865xysr17s.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (message from Spencer Baugh on Mon, 12 Feb 2024 17:10:34 -0500) Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: Stefan Monnier , Jason Rumney > From: Spencer Baugh > Date: Mon, 12 Feb 2024 17:10:34 -0500 > > 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. Bug#1310 and bug#1836 are also relevant here. > 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. after-init-time, I guess. But note that this still leaves a window between where that is set non-nil and starting the server. Also, the patch for server-start which prevents it from erroring out is still needed, because we do want to show the error message about being unable to start the daemon. And this solution will still print error messages that are not specific enough to be helpful. E.g., what do you do if you try starting the daemon and see wrong-type-argument, stringp, nil and that's all? And that is even before we consider the use case where stderr of the daemon is redirected to the great void, which happens in some cases. So my vote is still for diagnosing the important places where a fatal error could happen, and adding a clear diagnostic there. Yes, it is more work. But the gain will be much higher. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 13 08:02:43 2024 Received: (at 68799) by debbugs.gnu.org; 13 Feb 2024 13:02:43 +0000 Received: from localhost ([127.0.0.1]:42967 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZsQt-0005NR-1O for submit@debbugs.gnu.org; Tue, 13 Feb 2024 08:02:43 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:26186) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZsQq-0005N6-U2 for 68799@debbugs.gnu.org; Tue, 13 Feb 2024 08:02:42 -0500 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 0F5A9440696; Tue, 13 Feb 2024 08:02:18 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1707829337; bh=YxdVsom8BEBxS0y8qQLg3/5UwePEeDGkYePqnV32TdY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ig6wswWnI98y1c6qFgZLMQHFePCqLijc9Bw/qheVUPdxJoplpmZB2+kKM5vPRIlyh pi+6HBGDCPBmWTLoRck7no5YkDZ0XUhMKe3Rx4CcPwWNW+xyeEEfFRst0WzDtCvgA1 ukpyNOFgfsTVn1WbpwItg7le6Nd/AJGzDi+WPm1NU1hG4aHeJzsZqAUm75AV0tMYDj mruLz0P3n7RFhQVmFnFYozH9s6l6UYy28a/5Pwx2FuSh/AITXy0bN2tmLWENVGLLmb kQn+4n+NhSEgF7iUhKhS+2TSFPqZaYXMwCQsCe82TzINLHB57wdJjphIFqnjaMOP3e WrRmT1bz4TfEw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 0B550440B5F; Tue, 13 Feb 2024 08:02:17 -0500 (EST) Received: from pastel (unknown [45.72.197.152]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id D8F15120B6C; Tue, 13 Feb 2024 08:02:16 -0500 (EST) From: Stefan Monnier To: Spencer Baugh Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails In-Reply-To: (Spencer Baugh's message of "Mon, 12 Feb 2024 17:10:34 -0500") Message-ID: References: Date: Tue, 13 Feb 2024 08:02:16 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.003 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org, Jason Rumney X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> 1. emacs -Q --fg-daemon=/nonexistent/dir/sock >> 2. Emacs prints "Starting Emacs daemon." and sits in foreground. [...] >> 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 problem you point out later is real, but maybe more importantly we should make sure that any error gets printed at step 2. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 13 12:37:58 2024 Received: (at 68799) by debbugs.gnu.org; 13 Feb 2024 17:37:58 +0000 Received: from localhost ([127.0.0.1]:46685 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZwjF-0000eJ-V1 for submit@debbugs.gnu.org; Tue, 13 Feb 2024 12:37:58 -0500 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:46139) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZwjC-0000du-7P for 68799@debbugs.gnu.org; Tue, 13 Feb 2024 12:37:55 -0500 From: Spencer Baugh To: Eli Zaretskii Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails In-Reply-To: <865xysr17s.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 13 Feb 2024 14:35:35 +0200") References: <865xysr17s.fsf@gnu.org> Date: Tue, 13 Feb 2024 12:37:30 -0500 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1707845850; bh=+EyjngMLMKhwZGMbLlTUZhA/a46xAHo35Lzj+AyopmQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=xvcvaY9C5MfxUHSyJSjfkbCz7RCxgMQn+5b0MtR/eRDVC3U1ep9DYLXhy0/pnHWca 6OyDauAxi1VSOgO4nrkvwOUtNbmFlXAhno84uKfnD3ADU3P+b8GeztQ1dFj8CFjNG4 /8y+q7qAMowNHc+EeMXEaTn30I5+Oc5L8z+STBHHgopZJYDItcZuCqicz59Uaq6xkJ f3EJN2wk78f7BAy+yL6eqzU3Gi8IyTNrcVyxOA/R+vNOdL8sgertM/gqQifeItdv5w cJkL4QiEtHOBFwp/cDp9OYMic2jD0e3ihuKVeCFo7nb3LQ8tDeAvy0Y6C2gKT7SEnM AYg26gCRH3D9A== X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> Cc: Stefan Monnier , Jason Rumney >> From: Spencer Baugh >> Date: Mon, 12 Feb 2024 17:10:34 -0500 >> >> 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. > > Bug#1310 and bug#1836 are also relevant here. Indeed. >> 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. > > after-init-time, I guess. But note that this still leaves a window > between where that is set non-nil and starting the server. Oh, actually there is a DAEMON_RUNNING define which is exactly what we want here. DAEMON_RUNNING just didn't exist at the time the check on IS_DAEMON was added. Patch using DAEMON_RUNNING attached. > Also, the patch for server-start which prevents it from erroring out > is still needed, because we do want to show the error message about > being unable to start the daemon. > > And this solution will still print error messages that are not > specific enough to be helpful. E.g., what do you do if you try > starting the daemon and see > > wrong-type-argument, stringp, nil > > and that's all? And that is even before we consider the use case > where stderr of the daemon is redirected to the great void, which > happens in some cases. > > So my vote is still for diagnosing the important places where a fatal > error could happen, and adding a clear diagnostic there. Yes, it is > more work. But the gain will be much higher. Agreed, I will also work on that as a separate change. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Check-daemon-is-initialized-before-supressing-errors.patch >From a24a2b1ceb12f11c9d345190fbf554f27c4ec186 Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Tue, 13 Feb 2024 12:20:39 -0500 Subject: [PATCH] Check daemon is initialized before supressing errors Previously, the default error handler would correctly suppress unhandled errors raised when IS_DAEMON and the initial frame was current, since this is the normal state of operation for a daemon-mode Emacs. However, this also incorrectly suppressed errors raised while a daemon-mode Emacs was starting up. Now, errors raised while a daemon-mode Emacs is starting up will be handled just like errors when a non-daemon Emacs is starting up. This was previously the case before changes for bug#1310 and bug#1836, which added the suppression of errors when IS_DAEMON. DAEMON_RUNNING didn't exist at the time of those changes, but now it does, so we can do better. * src/keyboard.c (Fcommand_error_default_function): Check !DAEMON_RUNNING in addition to IS_DAEMON. (bug#68799) * src/lisp.h (DAEMON_RUNNING): Add a clarifying comment about what this define means. --- src/keyboard.c | 5 +++-- src/lisp.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/keyboard.c b/src/keyboard.c index ff89b1b3510..5c00996ea6d 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1076,8 +1076,9 @@ DEFUN ("command-error-default-function", Fcommand_error_default_function, 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)) + that case, as long as the daemon has actually finished + initialization. */ + || (!(IS_DAEMON && !DAEMON_RUNNING) && FRAME_INITIAL_P (sf)) || noninteractive)) { print_error_message (data, Qexternal_debugging_output, diff --git a/src/lisp.h b/src/lisp.h index 5326824bf38..176ca24b318 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -5038,6 +5038,7 @@ fast_c_string_match_ignore_case (Lisp_Object regexp, /* 0 not a daemon, 1 foreground daemon, 2 background daemon. */ extern int daemon_type; #define IS_DAEMON (daemon_type != 0) +/* True means daemon-initialized has not yet been called. */ #define DAEMON_RUNNING (daemon_type >= 0) #else /* WINDOWSNT */ extern void *w32_daemon_event; -- 2.39.3 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 13 12:52:30 2024 Received: (at 68799) by debbugs.gnu.org; 13 Feb 2024 17:52:30 +0000 Received: from localhost ([127.0.0.1]:46793 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZwxJ-0001CZ-Ou for submit@debbugs.gnu.org; Tue, 13 Feb 2024 12:52:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44112) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZwxI-0001CI-2X for 68799@debbugs.gnu.org; Tue, 13 Feb 2024 12:52:29 -0500 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 1rZwum-0002mz-DB; Tue, 13 Feb 2024 12:49:53 -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=i/RxMNIPYTB1qgFcqsYWsahxeOR48JLU9V54rsiKVx8=; b=dg897z40mFV3 eE2n7EwrzmOss0fc+kEpL608UFBirKGvwHzoca1MhBuQ6OFCqyYk45iWUG1XqjIZND36b9DxEjxRz ZfyzBccsTvIQ4qOAqeU0E+iqvEGMhI9w4mDZWQrVvI2GtU+68V4ULHFXiSPdE34GbXevFyY8uFqC/ zNzA0gFLysZuLLe6QoxIc4mkQQMwycGf9SlfIJ5rRIqryfhiLoYYxh0nPki6uYJYgw8nPuwYCj6ix xnciISEEdZtC2jydKuCQqPKS54SCIT0GcILeGYkwrTE89C+LmkVCfA0D9+HlPPzG1sIf+b9V+jv86 /S1kEg9BnzB8WQC7FR5oJg==; Date: Tue, 13 Feb 2024 19:49:48 +0200 Message-Id: <86mss4p83n.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (message from Spencer Baugh on Tue, 13 Feb 2024 12:37:30 -0500) Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails References: <865xysr17s.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Spencer Baugh > Cc: 68799@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org > Date: Tue, 13 Feb 2024 12:37:30 -0500 > > >> 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. > > > > after-init-time, I guess. But note that this still leaves a window > > between where that is set non-nil and starting the server. > > Oh, actually there is a DAEMON_RUNNING define which is exactly what we > want here. DAEMON_RUNNING just didn't exist at the time the check on > IS_DAEMON was added. Patch using DAEMON_RUNNING attached. Using DAEMON_RUNNING would mean any errors while starting the server will fail to show the explicit error message about that. That's a regression in my book. So I hope we can find a better solution. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 13 13:04:50 2024 Received: (at 68799) by debbugs.gnu.org; 13 Feb 2024 18:04:50 +0000 Received: from localhost ([127.0.0.1]:46880 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZx9G-0001ae-6Z for submit@debbugs.gnu.org; Tue, 13 Feb 2024 13:04:50 -0500 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:34131) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZx9C-0001aP-RT for 68799@debbugs.gnu.org; Tue, 13 Feb 2024 13:04:48 -0500 From: Spencer Baugh To: Eli Zaretskii Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails In-Reply-To: <86mss4p83n.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 13 Feb 2024 19:49:48 +0200") References: <865xysr17s.fsf@gnu.org> <86mss4p83n.fsf@gnu.org> Date: Tue, 13 Feb 2024 13:04:24 -0500 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1707847464; bh=lJTldqkhPwWSja3Hw8JkXJ2tRLHsSUm4R5ViZ0WsSRY=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=y6ttI/AmJsDg7BxESQJHE5RF7CxQ/8U84SOxQ4BhZGsHfF29JjdHZukzSImdrBLTt 6So4mlDtvbiE1D0fZbdCZowZ7NkBYzJVNsxrYoSeuoIdhhfRNgyXQ9CQnKmj4Ax7kD vOY+WLPYPdtAc6yJgoReJIuAbdJptOOrXl4cPvaWPkBa7wZ8Y64SrKUUNKCKeanuHF anchgKhQBIn5x71FVaND+CQllljbGApJMm/eTyNj14zn8h+DkZTxMkn7G1+AYEFYFG pvcvUizdTMr+vzce2/IIXgRMcQXE32yxB7WARZobbL+eI109+uA+33nK5UMn+xkaSb v8eZ7I6HawJCw== X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Spencer Baugh >> Cc: 68799@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org >> Date: Tue, 13 Feb 2024 12:37:30 -0500 >> >> >> 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. >> > >> > after-init-time, I guess. But note that this still leaves a window >> > between where that is set non-nil and starting the server. >> >> Oh, actually there is a DAEMON_RUNNING define which is exactly what we >> want here. DAEMON_RUNNING just didn't exist at the time the check on >> IS_DAEMON was added. Patch using DAEMON_RUNNING attached. > > Using DAEMON_RUNNING would mean any errors while starting the server > will fail to show the explicit error message about that. That's a > regression in my book. So I hope we can find a better solution. Could you be more specific about what would regress in this situation? Preferably with a step by step of something that behaves worse. Currently the error message doesn't get shown at all, so I'm not clear what could be regressing. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 13 14:46:34 2024 Received: (at 68799) by debbugs.gnu.org; 13 Feb 2024 19:46:35 +0000 Received: from localhost ([127.0.0.1]:47485 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZyji-0004h3-GB for submit@debbugs.gnu.org; Tue, 13 Feb 2024 14:46:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60670) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZyjd-0004gm-KI for 68799@debbugs.gnu.org; Tue, 13 Feb 2024 14:46:33 -0500 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 1rZyjF-0007EH-RY; Tue, 13 Feb 2024 14:46:05 -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=dKMbeXuDmmdZTIXI2eswQlJdPugBNNWVKY+RrAtRSAI=; b=LnpIe+cwigLD sArfusN9pdDBcO7v/Lzk9v5nO9361SFyL35kVnw8V/t+nNEi6jbNoDyP/hntJsyN9vEb7E0jfJr1p tbOlnU+FLUxHIPgY2XVpOqELz1SgcRxj+5PEcSzrSbD2R/7tUyCba376kvnAyOe9OhOOccGbGbjMr 45l920D9+/Vn1iBA0QPr3CkPBVPtsEnXt3Jp66isDnLulD0UtNMOEyhG2XDRVF77OY9yP/0tyK0Hd a/U2ImU4316I4zImE4qKywkVO9gpBWg4rfzCbQlYxNTVeHcGOy4+/9hTonGxWNEiL33iS5/PEKeIM MGpcOHmq6BCyVMNzy/YZhA==; Date: Tue, 13 Feb 2024 21:46:02 +0200 Message-Id: <86jzn8p2px.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (message from Spencer Baugh on Tue, 13 Feb 2024 13:04:24 -0500) Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails References: <865xysr17s.fsf@gnu.org> <86mss4p83n.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Spencer Baugh > Cc: 68799@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org > Date: Tue, 13 Feb 2024 13:04:24 -0500 > > Eli Zaretskii writes: > > > Using DAEMON_RUNNING would mean any errors while starting the server > > will fail to show the explicit error message about that. That's a > > regression in my book. So I hope we can find a better solution. > > Could you be more specific about what would regress in this situation? > Preferably with a step by step of something that behaves worse. I mean this error message: (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)))) > Currently the error message doesn't get shown at all, so I'm not clear > what could be regressing. We already established why the message doesn't show: because errors in server-start are not caught. I thought we also agreed that catching the errors there and letting startup.el show the above error messages is something that should be done. 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. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 13 15:02:27 2024 Received: (at 68799) by debbugs.gnu.org; 13 Feb 2024 20:02:27 +0000 Received: from localhost ([127.0.0.1]:47599 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZyz4-0005K3-M5 for submit@debbugs.gnu.org; Tue, 13 Feb 2024 15:02:27 -0500 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:47071) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZyz1-0005Jm-M1 for 68799@debbugs.gnu.org; Tue, 13 Feb 2024 15:02:25 -0500 From: Spencer Baugh To: Eli Zaretskii Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails In-Reply-To: <86jzn8p2px.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 13 Feb 2024 21:46:02 +0200") References: <865xysr17s.fsf@gnu.org> <86mss4p83n.fsf@gnu.org> <86jzn8p2px.fsf@gnu.org> Date: Tue, 13 Feb 2024 15:02:00 -0500 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1707854520; bh=FJFYpX0DjVjR8XakJb1gvp7BmjVn4m7yMXlw4gi6hl8=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=TZwprFEyLT+10zJJbTI6vDJO2oy/i/oWiMwwsQYgbcQFWHG53H+tm0UjJXPrQWM1D q2ShHuiAHxx0j8eYp9hs7CMFVajZwED42fcInUv36voc6ShoreYthIXQg/quyC2Ipv f+8WoJTkX2lGSggzXKYllOwej05VTW9GO5bjSypCNsY5d/4+wV/fJmldyjA6qnr0Kb dVQQRvXCi8vtWAVxvSSeJ/VS+WxBFi9hwWd8J6s6f0K0/adaP/ThoZi8dWgVVW8XSp eXORIAjB9H4bEZnPpiIc6h6QDOfHqPh/ebbAdChvsX1T0HDaSShX9v3Lnc6+7kZwPE s1Ib8GD6ggeDA== X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Spencer Baugh >> Cc: 68799@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org >> Date: Tue, 13 Feb 2024 13:04:24 -0500 >> >> Eli Zaretskii writes: >> >> > Using DAEMON_RUNNING would mean any errors while starting the server >> > will fail to show the explicit error message about that. That's a >> > regression in my book. So I hope we can find a better solution. >> >> Could you be more specific about what would regress in this situation? >> Preferably with a step by step of something that behaves worse. > > I mean this error message: > > (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)))) Yes. With my patch, those messages will still show in exactly the same cases. No regression. >> Currently the error message doesn't get shown at all, so I'm not clear >> what could be regressing. > > We already established why the message doesn't show: because errors in > server-start are not caught. I thought we also agreed that catching > the errors there and letting startup.el show the above error messages > is something that should be done. Yes. > 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. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 13 15:05:07 2024 Received: (at 68799) by debbugs.gnu.org; 13 Feb 2024 20:05:07 +0000 Received: from localhost ([127.0.0.1]:47615 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZz1f-0005PD-9b for submit@debbugs.gnu.org; Tue, 13 Feb 2024 15:05:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48532) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZz1b-0005OY-PW for 68799@debbugs.gnu.org; Tue, 13 Feb 2024 15:05:05 -0500 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 1rZz1E-0002KG-Jl; Tue, 13 Feb 2024 15:04:40 -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=MzPpKPLUM3cGzoJgQ1DiOFKvW0MfdnxVrF3F3GpxjzI=; b=GKWp0aYldmB8 V6k2FcwmbwC6g6oi10k8g6oYbsxaIIetJtMmuIpj2KN3b6WLN9MKT4asgLQG3IcFsrRTFtaY8cb7H lQ0uB9M6qTHKZIWVmu8M3yqGwBNbYKVQ/5NXiThk1kiw0UCLhadi2lWvICvEE6MIdL6RgPf6me7Hw wbnb6hxEdvT9RKj3LhpKfuBSYEUsBVNyvWfB5Dv1Ce12twN0cp3vlMHD44Gdnjz78+sPahv+nadwW Y8CFfNI/6ZS0ZoeSMvrqMFlGlbBFW041nITHtnWfRPbNy+X6rDG5ABW4gJYlTiFxhcZ2Y/zVY8mXf AA6Rlo1ytT3VcbJWka8Qbw==; Date: Tue, 13 Feb 2024 22:04:37 +0200 Message-Id: <86frxwp1uy.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (message from Spencer Baugh on Tue, 13 Feb 2024 15:02:00 -0500) Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails References: <865xysr17s.fsf@gnu.org> <86mss4p83n.fsf@gnu.org> <86jzn8p2px.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Spencer Baugh > 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. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 13 15:20:47 2024 Received: (at 68799) by debbugs.gnu.org; 13 Feb 2024 20:20:47 +0000 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 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 From: Spencer Baugh To: Eli Zaretskii Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails In-Reply-To: <86frxwp1uy.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 13 Feb 2024 22:04:37 +0200") References: <865xysr17s.fsf@gnu.org> <86mss4p83n.fsf@gnu.org> <86jzn8p2px.fsf@gnu.org> <86frxwp1uy.fsf@gnu.org> Date: Tue, 13 Feb 2024 15:20:21 -0500 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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) From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 13 16:31:38 2024 Received: (at 68799) by debbugs.gnu.org; 13 Feb 2024 21:31:38 +0000 Received: from localhost ([127.0.0.1]:48170 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ra0NO-0001Jv-Ie for submit@debbugs.gnu.org; Tue, 13 Feb 2024 16:31:38 -0500 Received: from thaodan.de ([185.216.177.71]:49726) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ra0NM-0001JE-3T for 68799@debbugs.gnu.org; Tue, 13 Feb 2024 16:31:37 -0500 Received: from odin (dsl-trebng12-50dc75-154.dhcp.inet.fi [80.220.117.154]) by thaodan.de (Postfix) with ESMTPSA id 0D27CD08CB8; Tue, 13 Feb 2024 23:30:42 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thaodan.de; s=mail; t=1707859842; bh=QFnkLTh9lQnKH4Nr7vMRPMxgQGB2iKw9Rl9NOoGSdCg=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=0TJtkVs3Wxau2qT2NJT4sHgWwtOOJ5V3xYX/YiO+bGZXkIk3HXzmu1Iu2TAEkiJtt PmF0xVSHJA4ZCQxSMb9EZEHYTvdIl3/bPbVd1U/Jj3zZ77jpBEYBb7J5HVnY5Lvqmw PXAvov/TXbkQuOYzWzQmrE3wEtu8ilBs1r7DSI2QBxo6kITHd8wo7pFLfqqeQwQx4r PnPvtEBCmIGUnhhRxRt00X3QzvfoyDeHlFC1mePbR0RkBRkJpBJxMS+DPLJIyBcO/0 JgybqU9kvA7DocXBJVy7kl5CEFdp11hwouNb2RY5ikPVjCoRxAMNS5x/u2ge+95ASN v1MwCZEnEzYc6uRl4ivm1nkbVWXYdNdBaTP1D4a7lJi/gvoDLBJS9JDCOmiM6iASe/ x5cAxX0Mylsn/7Xw6UqLMLyE07T7uFwDTDrLZIZTY2o4Kgq2EGdQDNDxOR73dTqQ9D rdFjT2CrIH6h7LjyvZajytga8kkrlYcPgHwHVZov/K5QnaQUCYWyRywK/Ybl6z2gTZ bEisAIfmw0rPmwu6qtI0lLsTtrn1k4yBccanb6NSj2Xmy6SAQeaf279Qj8ps+qIOg9 tzjQE1taJE/l4X3q0VouMRIJ7M3quvqziyh5eWR/uxZEH8CfDSDQ6FYzmLYNU+bqLY bC9Z/SmiFxOwTUykhxxDXIQU= From: =?utf-8?Q?Bj=C3=B6rn?= Bidar To: Spencer Baugh Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails In-Reply-To: (Spencer Baugh's message of "Mon, 29 Jan 2024 11:54:21 -0500") References: Autocrypt: addr=bjorn.bidar@thaodan.de; prefer-encrypt=nopreference; keydata= mDMEZNfpPhYJKwYBBAHaRw8BAQdACBEmr+0xwIIHZfIDlZmm7sa+lHHSb0g9FZrN6qE6ru60JUJq w7ZybiBCaWRhciA8Ympvcm4uYmlkYXJAdGhhb2Rhbi5kZT6IlgQTFgoAPgIbAwULCQgHAgIiAgYV CgkICwIEFgIDAQIeBwIXgBYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1/YmAhkBAAoJEFwbdKFl HF9oB9cBAJoIIGQKXm4cpap+Flxc/EGnYl0123lcEyzuduqvlDT0AQC3OlFKm/OiqJ8IMTrzJRZ8 phFssTkSrrFXnM2jm5PYDoiTBBMWCgA7FiEEUfF263VHMB6nKairXBt0oWUcX2gFAmTX6T4CGwMF CwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQXBt0oWUcX2hbCQEAtru7kvM8hi8zo6z9ux2h K+B5xViKuo7Z8K3IXuK5ugwA+wUfKzomzdBPhfxDsqLcEziGRxoyx0Q3ld9aermBUccHtBxCasO2 cm4gQmlkYXIgPG1lQHRoYW9kYW4uZGU+iJMEExYKADsCGwMFCwkIBwICIgIGFQoJCAsCBBYCAwEC HgcCF4AWIQRR8XbrdUcwHqcpqKtcG3ShZRxfaAUCZNf2FQAKCRBcG3ShZRxfaCzSAP4hZ7cSp0YN XYpcjHdsySh2MuBhhoPeLGXs+2kSiqBiOwD/TP8AgPEg/R+SI9GI9on7fBJJ0mp2IT8kZ2rhDOjg gA6IkwQTFgoAOxYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1+ntAhsDBQsJCAcCAiICBhUKCQgL AgQWAgMBAh4HAheAAAoJEFwbdKFlHF9oBgwA/iQHwe0VL4Df4GGTYlNjMSHFlIkBmN4UfYGLYj3E TrOUAQC51M+M3cjsL8WHdpBz6VAo6df9d+rVwhQ9vQuFHqevArg4BGTX6T4SCisGAQQBl1UBBQEB B0Cbohc3JEfn005/cm0AOGjSsW1ZxAkgaoVNjbpqk4MgNAMBCAeIeAQYFgoAIBYhBFHxdut1RzAe pymoq1wbdKFlHF9oBQJk1+k+AhsMAAoJEFwbdKFlHF9ooHABAKGmrGBic/Vys3BBrOQiRB3Z7izO HwhqTRpAqFZtXS2nAQDZhp/5aYw1TZjTzkm1KVt9QiYnjd/MvxRE9iaY6x4mDbgzBGTX6T4WCSsG AQQB2kcPAQEHQAgRJq/tMcCCB2XyA5WZpu7GvpRx0m9IPRWazeqhOq7uiO8EGBYKACAWIQRR8Xbr dUcwHqcpqKtcG3ShZRxfaAUCZNf71AIbIgCBCRBcG3ShZRxfaHYgBBkWCgAdFiEEUfF263VHMB6n KairXBt0oWUcX2gFAmTX+9QACgkQXBt0oWUcX2jeSwD6AtWn0cuo8IF35YRo4o3cDRJnUfJnbvJy GxyCDThR+zYBAKG6/jdwmZkBQZKslnDAbMMd2WfiZZT5JW3IWC4EaKMO7HkBAKYPGZ3UbfkRvfFK S+pQ9CgtNfkSJQBtT1Ob7Y6nsacgAQCpyXN7yppmhW/oBgivITPy9Lkg+V4NK9WZYZCU9Q7LBA== Date: Tue, 13 Feb 2024 23:30:41 +0200 Message-ID: <875xys127y.fsf@> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: A side effect of this bug and another is that when emacs --fg-daemon is used e.g. in combination with a systemd service. If the service takes to long to be ready when a user calls emacsclient that it [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.2 INVALID_MSGID Message-Id is not valid, according to RFC 2822 -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) A side effect of this bug and another is that when emacs --fg-daemon is used e.g. in combination with a systemd service. If the service takes to long to be ready when a user calls emacsclient that it using the standard desktop file it creates another daemon which will then make the Emacs started with --fg-daemon fail resulting in the emacs in the systemd service fail in circles. From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 14 09:26:28 2024 Received: (at 68799) by debbugs.gnu.org; 14 Feb 2024 14:26:28 +0000 Received: from localhost ([127.0.0.1]:50897 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raGDT-00016Y-SU for submit@debbugs.gnu.org; Wed, 14 Feb 2024 09:26:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47594) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raGDR-00016K-IW for 68799@debbugs.gnu.org; Wed, 14 Feb 2024 09:26:26 -0500 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 1raGAw-0003iy-Mm; Wed, 14 Feb 2024 09:23:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=hf5qBekvVimH4hWLfU7RBPeUAGE5eTkia4NybwWGKn0=; b=cbd7MV/r4DA1pRAR130A CmMtf9pMCGsru6E/7XmeWV4IwfhD20Gt1/oJyyXGhp7tWLasCHWgQGR2RYgcuwMvVdQ9001Lry0S2 8StxiZB7aR0yJG3lPD/xV7DDKFKux4bCLXc8+A2ZKkETsfpFOn/vj/MGQH2gU4ycqihhu9/BDdy/e 9gg4H5oahEBIC1yc/Qyih7uwC/5T4Rhb24oLsg0wvV/AiseqLmSdq3L7p9kKwbOSOOYZiCUzJT+7T dsRR+cW7MmVrvbDpMe88Elapm1uDKADikYPQK/xLb4Np4cZDpv9DoT6bR2vn2kKTe6auR2acbD0ux D4R4Bg9jBD646A==; Date: Wed, 14 Feb 2024 16:23:47 +0200 Message-Id: <86sf1vxgy4.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (message from Spencer Baugh on Tue, 13 Feb 2024 15:20:21 -0500) Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails 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: 8bit X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.2 (-----) > From: Spencer Baugh > Cc: 68799@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org > Date: Tue, 13 Feb 2024 15:20:21 -0500 > > 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)) That's an improvement, but maybe it will be even better if you append "; exiting" at the end of the message? From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 14 09:35:32 2024 Received: (at 68799) by debbugs.gnu.org; 14 Feb 2024 14:35:32 +0000 Received: from localhost ([127.0.0.1]:50908 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raGMF-0001Jh-Um for submit@debbugs.gnu.org; Wed, 14 Feb 2024 09:35:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35004) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raGMC-0001JR-Or for 68799@debbugs.gnu.org; Wed, 14 Feb 2024 09:35:29 -0500 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 1raGLo-0006hl-7P; Wed, 14 Feb 2024 09:35:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=W/TQwShaJSajZLdMIRj5hEwZjdKR7Rzpk5FAWXOAaFI=; b=gxhk2s04/dI155Anou2E DhalF+B490KtrMJHUTL248t+AZ1Dha7sWnDy7cG0c5j8PpIaA3kkZnmx3JhAj0VNyrpxTztuoRFkt vAWITDaELaVqYFA0L6uu52O7LGigQCCyTQXGEJk2U1WxfzaQlkLZad7m1HMBRTAKAJqk7inYN/p7r 2WPmHW2z7enj78LBLsZCXfUh7AW7AJP/PNEs/wel3PHV2X8kNsmR7AyiH3L/LZ5LYKev9vjNhq+Ns X11pearFhkVk1RrOxICrCr8Ae4dr2IWuT5TjaXd3L91eK40LYZnm5CWAWCI85XKbJ/hnEAL3vZnzg Dswq+Fj/LYleKQ==; Date: Wed, 14 Feb 2024 16:35:00 +0200 Message-Id: <86plwzxgff.fsf@gnu.org> From: Eli Zaretskii To: =?iso-8859-1?Q?Bj=F6rn?= Bidar In-Reply-To: <875xys127y.fsf@> (bug-gnu-emacs@gnu.org) Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails References: <875xys127y.fsf@> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org, sbaugh@janestreet.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.2 (-----) > Cc: 68799@debbugs.gnu.org > Date: Tue, 13 Feb 2024 23:30:41 +0200 > From: Björn Bidar via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > A side effect of this bug and another is that when emacs --fg-daemon is > used e.g. in combination with a systemd service. If the service > takes to long to be ready when a user calls emacsclient that it using > the standard desktop file it creates another daemon which will then > make the Emacs started with --fg-daemon fail resulting in the emacs in > the systemd service fail in circles. Please tell more details about the scenario you have in mind, because I don't think I follow. In particular, why would starting the daemon take too long? due to what problems? And how is user invoking emacsclient relevant in this case? AFAIU, systemd starts Emacs at system start or user login time, whereas emacsclient is invoked when the user wants to run some command or clicks a desktop shortcut, and those events are not adjacent in time. I'm probably missing something here. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 14 10:11:06 2024 Received: (at 68799) by debbugs.gnu.org; 14 Feb 2024 15:11:06 +0000 Received: from localhost ([127.0.0.1]:52703 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raGug-0002fM-9n for submit@debbugs.gnu.org; Wed, 14 Feb 2024 10:11:06 -0500 Received: from thaodan.de ([185.216.177.71]:47786) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raGue-0002ep-Mm for 68799@debbugs.gnu.org; Wed, 14 Feb 2024 10:11:05 -0500 Received: from odin (dsl-trebng12-50dc75-154.dhcp.inet.fi [80.220.117.154]) by thaodan.de (Postfix) with ESMTPSA id 6242ED0374E; Wed, 14 Feb 2024 17:10:40 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thaodan.de; s=mail; t=1707923440; bh=XCN5jPwcnSrVP/QUE2YE8ComiP0H6rEylH/NAzIgqhA=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=06g/KYaslx8p3SYxn5uBY06F4vJnC4ETeX8PKvAJzErAecTKsPPI7FCqI+58PbSke Aa+iMyH2xQehSu/SQP6uKB+Ug5nNs9Z1QY+c0XKUkn6uqSgJgwQlaqt2OmHuIWzJVG tX3PbylikKQtMngCpFAQ89WFfnkQuf0yveqpOXl5L3rUz6ogK8tD2s2jmxiJ57Ifm+ zHjBotz4QdngQfbJVVHSL3XyrRsSMTCgJ6B8qmq3yur5A9NAC5h/0Ndjy1x4cIEs07 bsoqGGnWe6uGQEaDozpTDy2aW01Qr00/mi+s61iicNmXMfgDkng/6GaYie1SVqWdM3 hJb1as/w25Yj4DEPeQxWlLIHkDFwNyxGCS6+J9Rfkgk+JVPeCp380BoeMpG+PQubGm ctZlb5bQRp8nKsJqOoC9sZ1AJdrfbyH3JCS8VZaR6BWvTacEX2Rej4Z4CM1F9PYPHT 0DQsje4U2DoAAMVUCdJjbwdw/4d89e/Sc5sW5Zw+ABLpEBwED5wUq+M8cJ4N2KNuld 71w6DOd4m4nYhH1PP5ojjj82QdwVvpC6zPMeGMH6UEeO1VmqkgLU2ERNFijG4/1oNG EH5RI81+BZb9qozVdXFltNKDlyCKBhwBDigH+6PlFD5ChvbufJl4I7Wh+zzSXYz8PB /PeMDWh/QIioNFWbCaCtMIHY= From: =?utf-8?Q?Bj=C3=B6rn?= Bidar To: Eli Zaretskii Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails In-Reply-To: <86plwzxgff.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 14 Feb 2024 16:35:00 +0200") References: <86plwzxgff.fsf@gnu.org> Autocrypt: addr=bjorn.bidar@thaodan.de; prefer-encrypt=nopreference; keydata= mDMEZNfpPhYJKwYBBAHaRw8BAQdACBEmr+0xwIIHZfIDlZmm7sa+lHHSb0g9FZrN6qE6ru60JUJq w7ZybiBCaWRhciA8Ympvcm4uYmlkYXJAdGhhb2Rhbi5kZT6IlgQTFgoAPgIbAwULCQgHAgIiAgYV CgkICwIEFgIDAQIeBwIXgBYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1/YmAhkBAAoJEFwbdKFl HF9oB9cBAJoIIGQKXm4cpap+Flxc/EGnYl0123lcEyzuduqvlDT0AQC3OlFKm/OiqJ8IMTrzJRZ8 phFssTkSrrFXnM2jm5PYDoiTBBMWCgA7FiEEUfF263VHMB6nKairXBt0oWUcX2gFAmTX6T4CGwMF CwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQXBt0oWUcX2hbCQEAtru7kvM8hi8zo6z9ux2h K+B5xViKuo7Z8K3IXuK5ugwA+wUfKzomzdBPhfxDsqLcEziGRxoyx0Q3ld9aermBUccHtBxCasO2 cm4gQmlkYXIgPG1lQHRoYW9kYW4uZGU+iJMEExYKADsCGwMFCwkIBwICIgIGFQoJCAsCBBYCAwEC HgcCF4AWIQRR8XbrdUcwHqcpqKtcG3ShZRxfaAUCZNf2FQAKCRBcG3ShZRxfaCzSAP4hZ7cSp0YN XYpcjHdsySh2MuBhhoPeLGXs+2kSiqBiOwD/TP8AgPEg/R+SI9GI9on7fBJJ0mp2IT8kZ2rhDOjg gA6IkwQTFgoAOxYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1+ntAhsDBQsJCAcCAiICBhUKCQgL AgQWAgMBAh4HAheAAAoJEFwbdKFlHF9oBgwA/iQHwe0VL4Df4GGTYlNjMSHFlIkBmN4UfYGLYj3E TrOUAQC51M+M3cjsL8WHdpBz6VAo6df9d+rVwhQ9vQuFHqevArg4BGTX6T4SCisGAQQBl1UBBQEB B0Cbohc3JEfn005/cm0AOGjSsW1ZxAkgaoVNjbpqk4MgNAMBCAeIeAQYFgoAIBYhBFHxdut1RzAe pymoq1wbdKFlHF9oBQJk1+k+AhsMAAoJEFwbdKFlHF9ooHABAKGmrGBic/Vys3BBrOQiRB3Z7izO HwhqTRpAqFZtXS2nAQDZhp/5aYw1TZjTzkm1KVt9QiYnjd/MvxRE9iaY6x4mDbgzBGTX6T4WCSsG AQQB2kcPAQEHQAgRJq/tMcCCB2XyA5WZpu7GvpRx0m9IPRWazeqhOq7uiO8EGBYKACAWIQRR8Xbr dUcwHqcpqKtcG3ShZRxfaAUCZNf71AIbIgCBCRBcG3ShZRxfaHYgBBkWCgAdFiEEUfF263VHMB6n KairXBt0oWUcX2gFAmTX+9QACgkQXBt0oWUcX2jeSwD6AtWn0cuo8IF35YRo4o3cDRJnUfJnbvJy GxyCDThR+zYBAKG6/jdwmZkBQZKslnDAbMMd2WfiZZT5JW3IWC4EaKMO7HkBAKYPGZ3UbfkRvfFK S+pQ9CgtNfkSJQBtT1Ob7Y6nsacgAQCpyXN7yppmhW/oBgivITPy9Lkg+V4NK9WZYZCU9Q7LBA== Date: Wed, 14 Feb 2024 17:10:39 +0200 Message-ID: <87plwzytcg.fsf@> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org, sbaugh@janestreet.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Eli Zaretskii writes: >> Cc: 68799@debbugs.gnu.org >> Date: Tue, 13 Feb 2024 23:30:41 +0200 >> From: Bj=C3=B6rn Bidar via "Bug reports for GNU Emacs, >> the Swiss army knife of text editors" >>=20 >> A side effect of this bug and another is that when emacs --fg-daemon is >> used e.g. in combination with a systemd service. If the service >> takes to long to be ready when a user calls emacsclient that it using >> the standard desktop file it creates another daemon which will then >> make the Emacs started with --fg-daemon fail resulting in the emacs in >> the systemd service fail in circles. > > Please tell more details about the scenario you have in mind, because > I don't think I follow. In particular, why would starting the daemon > take too long? due to what problems? And how is user invoking > emacsclient relevant in this case? AFAIU, systemd starts Emacs at > system start or user login time, whereas emacsclient is invoked when > the user wants to run some command or clicks a desktop shortcut, and > those events are not adjacent in time. > 0. User logs in 1. The session reaches graphical-session.target 2. Emacs executed in emacs.service=20 3. Emacs launches with all it's modes loaded, desktop-mode session restored etc. 4. Emacs is ready to receive commands When the user starts emacsclient before step 4 is reached then it can timeout because it can take some time till Emacs is ready. Step 1. Starts all parts of the programs which require a graphical session including the desktop environment that the user is likely to call upon emacsclient. From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 14 10:31:55 2024 Received: (at 68799) by debbugs.gnu.org; 14 Feb 2024 15:31:55 +0000 Received: from localhost ([127.0.0.1]:52786 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raHEo-0003DE-M9 for submit@debbugs.gnu.org; Wed, 14 Feb 2024 10:31:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40266) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raHEn-0003D1-9V for 68799@debbugs.gnu.org; Wed, 14 Feb 2024 10:31:54 -0500 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 1raHEL-0003gR-Lp; Wed, 14 Feb 2024 10:31:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=HZfwNnNcg2prqBQXwTAlN42VH9blp4rBW6uu/MetaJ8=; b=MTo3FMYqlyOgLudkOsWQ oGbzTMVlzIbvEh6R9rjKzNZb/axyPdFhqbnotPVEDiDG7s8x3kfjuZUet0VRmABjGhIOoh/x/vKNc KWIJ64tSZRE1wxuL+MfgGLSHA0RJ6r/MiBokZ9JqKH591q4AKR3ddPRz4YqlOccpT6Zocmv5MHcLG KQVlyTdLq+Qwg5rNFEwpm0laJKhh9vXRCzBIZtIBal1328PmbcH7TS1V9tJygVMcv+Xu9+DA1DSkM bO0h4gXfT4YQiXeRpRdZY6VZZ2wmLKodYJaXTAF8flJ9nvAVdwybco2yf3MvfRSsTknA6C1AFCVxP I1cfDC7CqfthYQ==; Date: Wed, 14 Feb 2024 17:31:19 +0200 Message-Id: <86cyszxdtk.fsf@gnu.org> From: Eli Zaretskii To: =?utf-8?Q?Bj=C3=B6rn?= Bidar In-Reply-To: <87plwzytcg.fsf@> (message from =?utf-8?Q?Bj=C3=B6rn?= Bidar on Wed, 14 Feb 2024 17:10:39 +0200) Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails References: <86plwzxgff.fsf@gnu.org> <87plwzytcg.fsf@> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org, sbaugh@janestreet.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.2 (-----) > From: Björn Bidar > Cc: sbaugh@janestreet.com, 68799@debbugs.gnu.org > Date: Wed, 14 Feb 2024 17:10:39 +0200 > > 0. User logs in > 1. The session reaches graphical-session.target > 2. Emacs executed in emacs.service > 3. Emacs launches with all it's modes loaded, desktop-mode session > restored etc. > 4. Emacs is ready to receive commands > > When the user starts emacsclient before step 4 is reached then it can > timeout because it can take some time till Emacs is ready. Wouldn't this be a cockpit mistake? The user presumably knows that loading desktop takes some time, and should give Emacs that time before invoking emacsclient. No? From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 14 11:11:37 2024 Received: (at 68799) by debbugs.gnu.org; 14 Feb 2024 16:11:37 +0000 Received: from localhost ([127.0.0.1]:52887 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raHrF-0004LA-1G for submit@debbugs.gnu.org; Wed, 14 Feb 2024 11:11:37 -0500 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:59165) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raHrC-0004Kw-8r for 68799@debbugs.gnu.org; Wed, 14 Feb 2024 11:11:35 -0500 From: Spencer Baugh To: Eli Zaretskii Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails In-Reply-To: <86sf1vxgy4.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 14 Feb 2024 16:23:47 +0200") References: <865xysr17s.fsf@gnu.org> <86mss4p83n.fsf@gnu.org> <86jzn8p2px.fsf@gnu.org> <86frxwp1uy.fsf@gnu.org> <86sf1vxgy4.fsf@gnu.org> Date: Wed, 14 Feb 2024 11:11:10 -0500 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1707927070; bh=KNg0RzGCRZaCTtOs2wGj0284NhKVDi/C72tk7vuV8fM=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=nrXOroN7nszqag2UfmyePUxR4SnBENZxj/GLEfqr7UDBrLa3nAdZkS9wJwRk7TtBH TSMCgqxp5JNbVQpiVwsGzo4c43QWvJ1V/6F2u4CyAie+5ol1HerRwrmk6HsAmAhu5P oJRvszS8dwNFf+TRFUllEi70Yi4OwJ/kzODIxZJRJWaaIbA7tdkOOHpVpLVJji3SLO pb6oMAG1DihK9Z6nl+LV3ytM7JZHxOrdLDX+Smc2xU2NzUrzhe2jJwXd0RHYu+9O2t hKGOANjHU6rl01RM1SDWtEtTt7KkBuGcQ5jwC5nHx31B0ZlMastKDXZHDb9GTTAvbm xkkuO6eL2+t6Q== X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.9 (--) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> From: Spencer Baugh >> Cc: 68799@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org >> Date: Tue, 13 Feb 2024 15:20:21 -0500 >>=20 >> To be clear, the patch I posted which checks DAEMON_RUNNING *does* solve >> that. >>=20 >> $ ./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 b= y you (owner =3D root (0)) >> $=20 >>=20 >> (which previously would have hung) >>=20 >> The issue now is solely that the printed error message is maybe not >> informative enough. >>=20 >> So how about the following diff, which changes the output to: >>=20 >> $ ./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 b= ecause it is not owned by you (owner =3D root (0)) > > That's an improvement, but maybe it will be even better if you append > "; exiting" at the end of the message? Can do. Here's the patch, which should be applied in addition to the DAEMON_RUNNING patch I posted earlier. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Add-context-to-errors-thrown-by-server-start-during-.patch >From d65f34b76c4d4496bdb2c53bede45db1869af232 Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Wed, 14 Feb 2024 11:09:33 -0500 Subject: [PATCH] Add context to errors thrown by server-start during startup When server-start errors during startup, the error is printed to the terminal without context. To help the user understand better what went wrong, that printed error now mentions that the error came from starting up the daemon. * lisp/startup.el (command-line): Catch and annotate errors thrown by server-start. (bug#68799) --- lisp/startup.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/startup.el b/lisp/startup.el index 773765a4b97..4871cf3d21f 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; exiting" (error-message-string err)))) (if server-process (daemon-initialized) (if (stringp dn) -- 2.39.3 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 14 12:41:27 2024 Received: (at 68799) by debbugs.gnu.org; 14 Feb 2024 17:41:27 +0000 Received: from localhost ([127.0.0.1]:53000 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raJGB-0006d3-9u for submit@debbugs.gnu.org; Wed, 14 Feb 2024 12:41:27 -0500 Received: from thaodan.de ([185.216.177.71]:58482) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raJG9-0006cp-Kq for 68799@debbugs.gnu.org; Wed, 14 Feb 2024 12:41:26 -0500 Received: from odin (dsl-trebng12-50dc75-154.dhcp.inet.fi [80.220.117.154]) by thaodan.de (Postfix) with ESMTPSA id 16CBFD00316; Wed, 14 Feb 2024 19:40:31 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thaodan.de; s=mail; t=1707932431; bh=4blHcNC7pLdHW2BvXJAV1SEky1LSTn6ASsJRu9v6E3I=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=ZvWceZHAqGBHQF8BSG+jCylPmgJien1EcbQrR6DEGidGfAyEbzbdTGcjoxaEqKIFA Bn5/HVvQPtymnIcywwkzT7n0GCJJCZHD7PnG8iTTCnZc92I5dhL9cTNoP55wYP+pYs 0g7KId6mm/RreczeZXSXa5JAYe2UaEHr4gDmUrp5JpncgPkjXz2Dc79pH6mVxWXs2K q1zQ9GSFOKf8milXYs81Y+1jONbs+OfIT+4tHTU0x49nHJkNP3nQWyt0ssVWqkX8uw cdAjW+52E6Rslre16WNAQUj2xYr7KeUheDdw3Dy3/F64gq3TjBRD1yIHgZC561HK9I iUXeO5tn+wf/oB0SmvIxuqGMsSD4nFTnRwY47pIKdvLYE8ln0O0JWCpQXQzNRWyPQ5 cZcyUf7xZ7JBzLsAupvbSXDz3E+VWng+wzvzHkGqW5PEK6L8yogk+63h9LROhoXEUj a7ySyijJnYRxKFPgVrv7oZzg/mYBJ6VBhho6aP/oTalQ35kHXuVZoHUqx+Uq9UwHlK aP303W57OGVc1lZXKpoEJZSgkHAXMRVCWXWHtgfA2HpJ9WqJVI6b1qZC0YmkLzWsBi E42xZj5XZpQI++UKMH2bHCou+Qio3MLdaBDhc0e9FUqlwbphwOImEk/eGKeEiWM74w 99Q0WnCTHk4S5IqtvaZOu39w= From: =?utf-8?Q?Bj=C3=B6rn?= Bidar To: Eli Zaretskii Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails In-Reply-To: <86cyszxdtk.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 14 Feb 2024 17:31:19 +0200") References: <86plwzxgff.fsf@gnu.org> <86cyszxdtk.fsf@gnu.org> Autocrypt: addr=bjorn.bidar@thaodan.de; prefer-encrypt=nopreference; keydata= mDMEZNfpPhYJKwYBBAHaRw8BAQdACBEmr+0xwIIHZfIDlZmm7sa+lHHSb0g9FZrN6qE6ru60JUJq w7ZybiBCaWRhciA8Ympvcm4uYmlkYXJAdGhhb2Rhbi5kZT6IlgQTFgoAPgIbAwULCQgHAgIiAgYV CgkICwIEFgIDAQIeBwIXgBYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1/YmAhkBAAoJEFwbdKFl HF9oB9cBAJoIIGQKXm4cpap+Flxc/EGnYl0123lcEyzuduqvlDT0AQC3OlFKm/OiqJ8IMTrzJRZ8 phFssTkSrrFXnM2jm5PYDoiTBBMWCgA7FiEEUfF263VHMB6nKairXBt0oWUcX2gFAmTX6T4CGwMF CwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQXBt0oWUcX2hbCQEAtru7kvM8hi8zo6z9ux2h K+B5xViKuo7Z8K3IXuK5ugwA+wUfKzomzdBPhfxDsqLcEziGRxoyx0Q3ld9aermBUccHtBxCasO2 cm4gQmlkYXIgPG1lQHRoYW9kYW4uZGU+iJMEExYKADsCGwMFCwkIBwICIgIGFQoJCAsCBBYCAwEC HgcCF4AWIQRR8XbrdUcwHqcpqKtcG3ShZRxfaAUCZNf2FQAKCRBcG3ShZRxfaCzSAP4hZ7cSp0YN XYpcjHdsySh2MuBhhoPeLGXs+2kSiqBiOwD/TP8AgPEg/R+SI9GI9on7fBJJ0mp2IT8kZ2rhDOjg gA6IkwQTFgoAOxYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1+ntAhsDBQsJCAcCAiICBhUKCQgL AgQWAgMBAh4HAheAAAoJEFwbdKFlHF9oBgwA/iQHwe0VL4Df4GGTYlNjMSHFlIkBmN4UfYGLYj3E TrOUAQC51M+M3cjsL8WHdpBz6VAo6df9d+rVwhQ9vQuFHqevArg4BGTX6T4SCisGAQQBl1UBBQEB B0Cbohc3JEfn005/cm0AOGjSsW1ZxAkgaoVNjbpqk4MgNAMBCAeIeAQYFgoAIBYhBFHxdut1RzAe pymoq1wbdKFlHF9oBQJk1+k+AhsMAAoJEFwbdKFlHF9ooHABAKGmrGBic/Vys3BBrOQiRB3Z7izO HwhqTRpAqFZtXS2nAQDZhp/5aYw1TZjTzkm1KVt9QiYnjd/MvxRE9iaY6x4mDbgzBGTX6T4WCSsG AQQB2kcPAQEHQAgRJq/tMcCCB2XyA5WZpu7GvpRx0m9IPRWazeqhOq7uiO8EGBYKACAWIQRR8Xbr dUcwHqcpqKtcG3ShZRxfaAUCZNf71AIbIgCBCRBcG3ShZRxfaHYgBBkWCgAdFiEEUfF263VHMB6n KairXBt0oWUcX2gFAmTX+9QACgkQXBt0oWUcX2jeSwD6AtWn0cuo8IF35YRo4o3cDRJnUfJnbvJy GxyCDThR+zYBAKG6/jdwmZkBQZKslnDAbMMd2WfiZZT5JW3IWC4EaKMO7HkBAKYPGZ3UbfkRvfFK S+pQ9CgtNfkSJQBtT1Ob7Y6nsacgAQCpyXN7yppmhW/oBgivITPy9Lkg+V4NK9WZYZCU9Q7LBA== Date: Wed, 14 Feb 2024 19:40:30 +0200 Message-ID: <87il2rymep.fsf@> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: 68799 Cc: 68799@debbugs.gnu.org, sbaugh@janestreet.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Eli Zaretskii writes: >> From: Bj=C3=B6rn Bidar >> Cc: sbaugh@janestreet.com, 68799@debbugs.gnu.org >> Date: Wed, 14 Feb 2024 17:10:39 +0200 >>=20 >> 0. User logs in >> 1. The session reaches graphical-session.target >> 2. Emacs executed in emacs.service=20 >> 3. Emacs launches with all it's modes loaded, desktop-mode session >> restored etc. >> 4. Emacs is ready to receive commands >>=20 >> When the user starts emacsclient before step 4 is reached then it can >> timeout because it can take some time till Emacs is ready. > > Wouldn't this be a cockpit mistake? The user presumably knows that > loading desktop takes some time, and should give Emacs that time > before invoking emacsclient. No? Of course but it the user doesn't know how exactly Emacs takes to start and to avoid race conditions it would make sense to wait. From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 24 04:21:25 2024 Received: (at 68799-done) by debbugs.gnu.org; 24 Feb 2024 09:21:26 +0000 Received: from localhost ([127.0.0.1]:41874 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdoDi-0006aJ-Hi for submit@debbugs.gnu.org; Sat, 24 Feb 2024 04:21:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdoDf-0006Zq-0n for 68799-done@debbugs.gnu.org; Sat, 24 Feb 2024 04:21:20 -0500 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 1rdoDA-0001dX-Su; Sat, 24 Feb 2024 04:20:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=QHF7ZbRtspKLQb51dw4faAK4N2J3Smu7/mucwLUhOlE=; b=CqC+78aKyigd46rBchTC 1Q9Ls3CQtVCrcuSyPaamW4hJlDf9qQPxZ0ivmBvbu0YU2ZGL4FNsCGANMiZw0N4rOE4x9nhHJFX8M XhL32YBfFhM1UQSkU+PK58jPiicYwV2fSFVQJmnvWi+1qePVbnA46CQfDc7xeEkY2sN4Qxz1rFlb2 kVVpTarImbPez21/sm25rH6gqZXoRwyff4VdJYfr+5X4/hfm9Fk3BdTJDD3q1ZczUr7PpQIdDXkBD anLL21fyZ1VgJeSshnUdOYlPruAKdODtFFvd+NdoQN32xTe+nYrBm18OrGAsw2BhTZtyPpqlNawnZ LmT06tjyEpB4LA==; Date: Sat, 24 Feb 2024 11:20:46 +0200 Message-Id: <86msrqz09d.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (message from Spencer Baugh on Wed, 14 Feb 2024 11:11:10 -0500) Subject: Re: bug#68799: 30.0.50; emacs --fg-daemon fails silently if server-start fails References: <865xysr17s.fsf@gnu.org> <86mss4p83n.fsf@gnu.org> <86jzn8p2px.fsf@gnu.org> <86frxwp1uy.fsf@gnu.org> <86sf1vxgy4.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68799-done Cc: 68799-done@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Spencer Baugh > Cc: 68799@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org > Date: Wed, 14 Feb 2024 11:11:10 -0500 > > Eli Zaretskii writes: > > >> From: Spencer Baugh > >> Cc: 68799@debbugs.gnu.org, monnier@iro.umontreal.ca, jasonr@gnu.org > >> Date: Tue, 13 Feb 2024 15:20:21 -0500 > >> > >> 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)) > > > > That's an improvement, but maybe it will be even better if you append > > "; exiting" at the end of the message? > > Can do. Here's the patch, which should be applied in addition to the > DAEMON_RUNNING patch I posted earlier. Thanks, installed. From unknown Fri Jun 20 07:19:22 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 23 Mar 2024 11:24:17 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator