From unknown Sun Aug 17 04:15:33 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#60096 <60096@debbugs.gnu.org> To: bug#60096 <60096@debbugs.gnu.org> Subject: Status: 29.0.60; Crash in format_mode_line_unwind_data Reply-To: bug#60096 <60096@debbugs.gnu.org> Date: Sun, 17 Aug 2025 11:15:33 +0000 retitle 60096 29.0.60; Crash in format_mode_line_unwind_data reassign 60096 emacs submitter 60096 Juri Linkov severity 60096 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 15 12:39:32 2022 Received: (at submit) by debbugs.gnu.org; 15 Dec 2022 17:39:32 +0000 Received: from localhost ([127.0.0.1]:43935 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p5sCi-0002zB-0W for submit@debbugs.gnu.org; Thu, 15 Dec 2022 12:39:32 -0500 Received: from lists.gnu.org ([209.51.188.17]:60378) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p5sCf-0002z5-7m for submit@debbugs.gnu.org; Thu, 15 Dec 2022 12:39:30 -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 1p5sCe-0007pH-Um for bug-gnu-emacs@gnu.org; Thu, 15 Dec 2022 12:39:28 -0500 Received: from relay3-d.mail.gandi.net ([2001:4b98:dc4:8::223]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p5sCc-0008Bo-HQ for bug-gnu-emacs@gnu.org; Thu, 15 Dec 2022 12:39:28 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 8661360002 for ; Thu, 15 Dec 2022 17:39:21 +0000 (UTC) From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: 29.0.60; Crash in format_mode_line_unwind_data Organization: LINKOV.NET Date: Thu, 15 Dec 2022 19:04:30 +0200 Message-ID: <86a63oen2m.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2001:4b98:dc4:8::223; envelope-from=juri@linkov.net; helo=relay3-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) 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: -2.6 (--) 0. emacs -Q 1. Evaluate: (add-hook 'kill-buffer-hook (lambda () (run-with-timer 0 nil (lambda () (tab-bar-select-tab 1))))) 2. Type: C-x t 2 C-x k RET Thread 1 "emacs" received signal SIGSEGV, Segmentation fault. format_mode_line_unwind_data (target_frame=target_frame@entry=0x5555563c3310, obuf=, owin=XIL(0x55555602562d), save_proptrans=save_proptrans@entry=false) at xdisp.c:13223 13223 current_buffer = b; (gdb) bt #0 format_mode_line_unwind_data (target_frame=target_frame@entry=0x5555563c3310, obuf=, owin=XIL(0x55555602562d), save_proptrans=save_proptrans@entry=false) at xdisp.c:13223 #1 0x0000555555600752 in gui_consider_frame_title (frame=XIL(0x5555563c3315)) at xdisp.c:13417 #2 0x0000555555605219 in prepare_menu_bars () at xdisp.c:13544 #3 redisplay_internal () at xdisp.c:16462 #4 0x00005555556ea03a in read_char (commandflag=1, map=XIL(0x555556770ea3), prev_event=XIL(0), used_mouse_menu=0x7fffffffddcb, end_time=0x0) at keyboard.c:2627 #5 0x00005555556ec658 in read_key_sequence (keybuf=, prompt=XIL(0), dont_downcase_last=, can_return_switch_frame=true, fix_current_buffer=true, prevent_redisplay=) at keyboard.c:10074 #6 0x00005555556ee2c0 in command_loop_1 () at lisp.h:1171 #7 0x000055555576a1b7 in internal_condition_case (bfun=bfun@entry=0x5555556ee0e0 , handlers=handlers@entry=XIL(0x90), hfun=hfun@entry=0x5555556e11b0 ) at eval.c:1474 #8 0x00005555556d986a in command_loop_2 (handlers=handlers@entry=XIL(0x90)) at keyboard.c:1125 #9 0x000055555576a0f9 in internal_catch (tag=tag@entry=XIL(0xfa80), func=func@entry=0x5555556d9840 , arg=arg@entry=XIL(0x90)) at eval.c:1197 #10 0x00005555556d9806 in command_loop () at lisp.h:1171 #11 0x00005555556e0d08 in recursive_edit_1 () at keyboard.c:712 #12 0x00005555556e10b0 in Frecursive_edit () at keyboard.c:795 #13 0x00005555555b1a73 in main (argc=, argv=) at emacs.c:2529 Lisp Backtrace: "redisplay_internal (C function)" (0x0) (gdb) l 13218 13219 /* If we select a window on another frame, make sure that that 13220 selection does not leave its buffer's point modified when 13221 unwinding (Bug#32777). */ 13222 ASET (vector, 10, buffer); 13223 current_buffer = b; 13224 ASET (vector, 11, build_marker (current_buffer, PT, PT_BYTE)); 13225 current_buffer = cb; 13226 } 13227 (gdb) p buffer $3 = XIL(0) This means that at this point the value of this is nil: XWINDOW (target_frame->selected_window)->contents; From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 15 16:42:38 2022 Received: (at 60096) by debbugs.gnu.org; 15 Dec 2022 21:42:39 +0000 Received: from localhost ([127.0.0.1]:45085 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p5vzy-00047A-GO for submit@debbugs.gnu.org; Thu, 15 Dec 2022 16:42:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39752) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p5vzv-000470-Jv for 60096@debbugs.gnu.org; Thu, 15 Dec 2022 16:42:37 -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 1p5vzp-0004x0-G2; Thu, 15 Dec 2022 16:42:29 -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=5wlG0PNf+X0nZDmT8m7/pAO6Wfvz90y+0ZnTbLKOE2o=; b=JF9eR6U2NyGa XxV5gME14/9dbirRMKTlSSyyttPSl2WEONtJJ1HNM/9ul8x1wKylGEkN55JmsjPlhte1SKDGqCiI+ z02zpdx7W3Luo0lfYFHLAuumiBn/OblDtz96zh9VXKr4zzrergzqOvyceLEDPN/W42W0mhfJyIVBk pqBiY4zMPSujFxqU0SNaqUf0j2mJlxnXh81RYdG4jT4DZCabTp9AG6iiQU3iGrPRmA2UMt3XzEWUX s30vdHCl0aGHM/R6BfOdbg2o+Mzp3MKU58m9lSAJy9dOfQLuMMeCgjcHLXV5Crk88KNLVBCv0R1np Xdha5P4ubbAPHiX4/UL7xg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p5vzo-0005J4-I2; Thu, 15 Dec 2022 16:42:29 -0500 Date: Thu, 15 Dec 2022 23:42:28 +0200 Message-Id: <83sfhgjqd7.fsf@gnu.org> From: Eli Zaretskii To: Juri Linkov In-Reply-To: <86a63oen2m.fsf@mail.linkov.net> (message from Juri Linkov on Thu, 15 Dec 2022 19:04:30 +0200) Subject: Re: bug#60096: 29.0.60; Crash in format_mode_line_unwind_data References: <86a63oen2m.fsf@mail.linkov.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60096 Cc: 60096@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: Juri Linkov > Date: Thu, 15 Dec 2022 19:04:30 +0200 > > 0. emacs -Q > 1. Evaluate: > > (add-hook 'kill-buffer-hook > (lambda () > (run-with-timer 0 nil (lambda () (tab-bar-select-tab 1))))) > > 2. Type: > > C-x t 2 > C-x k RET > > Thread 1 "emacs" received signal SIGSEGV, Segmentation fault. > format_mode_line_unwind_data (target_frame=target_frame@entry=0x5555563c3310, obuf=, owin=XIL(0x55555602562d), save_proptrans=save_proptrans@entry=false) at xdisp.c:13223 > 13223 current_buffer = b; Thanks, should be fixed now on the release branch. From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 16 02:33:31 2022 Received: (at 60096-done) by debbugs.gnu.org; 16 Dec 2022 07:33:31 +0000 Received: from localhost ([127.0.0.1]:47708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p65Dj-0005In-EC for submit@debbugs.gnu.org; Fri, 16 Dec 2022 02:33:31 -0500 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:54647) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p65Dd-0005Ic-Gy for 60096-done@debbugs.gnu.org; Fri, 16 Dec 2022 02:33:26 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id E30801BF204; Fri, 16 Dec 2022 07:33:13 +0000 (UTC) From: Juri Linkov To: Eli Zaretskii Subject: Re: bug#60096: 29.0.60; Crash in format_mode_line_unwind_data In-Reply-To: <83sfhgjqd7.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 15 Dec 2022 23:42:28 +0200") Organization: LINKOV.NET References: <86a63oen2m.fsf@mail.linkov.net> <83sfhgjqd7.fsf@gnu.org> Date: Fri, 16 Dec 2022 09:31:36 +0200 Message-ID: <86cz8jls87.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60096-done Cc: 60096-done@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.7 (-) >> (add-hook 'kill-buffer-hook >> (lambda () >> (run-with-timer 0 nil (lambda () (tab-bar-select-tab 1))))) >> >> 2. Type: >> >> C-x t 2 >> C-x k RET >> >> Thread 1 "emacs" received signal SIGSEGV, Segmentation fault. >> format_mode_line_unwind_data (target_frame=target_frame@entry=0x5555563c3310, obuf=, owin=XIL(0x55555602562d), save_proptrans=save_proptrans@entry=false) at xdisp.c:13223 >> 13223 current_buffer = b; > > Thanks, should be fixed now on the release branch. I confirm that it's fixed, so closing. PS: I wonder why now *scratch* shows keybindings inside non-standard quotation marks: "C-x C-f"? Why not 'C-x C-f'? Or `C-x C-f'? From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 16 06:46:15 2022 Received: (at 60096) by debbugs.gnu.org; 16 Dec 2022 11:46:15 +0000 Received: from localhost ([127.0.0.1]:48796 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p69AN-00081I-4p for submit@debbugs.gnu.org; Fri, 16 Dec 2022 06:46:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53264) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p69AL-00081C-Ey for 60096@debbugs.gnu.org; Fri, 16 Dec 2022 06:46:13 -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 1p69AF-0004VG-EL; Fri, 16 Dec 2022 06:46:07 -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=EVeFvgZRDK+WBljVl7pAvuWKv9YswPS80Py8LvS15sw=; b=aI63xf6VjrpX 3RcPVGLG4oZSyQ4S3OkuVqcovh0ilTZnue8eDe7VMK+IRwZc5QptH1lLTLKXzCPM4R0AIlSFz0SmN 06aupTkmOMw27PM9gP/NtJIk3pn2r2hvQWdpvREojO9NYntFheHasy+QiNlJwXx3pOEkTSgVd99I8 rCokWN0ZobomJzSEJbxddGGUBS0Y3z6cv+yfOUybiSJQXmupOb5d4Uuo4TWKIEfP6doKQ/QAaj5iL +cLLAu/gnViMBUjhefs1dWgOVfeLcTuBPfpLtRvNmvHTAwJG+g31HB8DvrxVqnsof+LeyQv8cX8zr Nk2gWXFBZRMcrFne/ws+yw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p69AD-000518-63; Fri, 16 Dec 2022 06:46:07 -0500 Date: Fri, 16 Dec 2022 13:46:07 +0200 Message-Id: <83k02rk1vk.fsf@gnu.org> From: Eli Zaretskii To: Juri Linkov In-Reply-To: <86cz8jls87.fsf@mail.linkov.net> (message from Juri Linkov on Fri, 16 Dec 2022 09:31:36 +0200) Subject: Re: bug#60096: 29.0.60; Crash in format_mode_line_unwind_data References: <86a63oen2m.fsf@mail.linkov.net> <83sfhgjqd7.fsf@gnu.org> <86cz8jls87.fsf@mail.linkov.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60096 Cc: 60096@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: Juri Linkov > Cc: 60096-done@debbugs.gnu.org > Date: Fri, 16 Dec 2022 09:31:36 +0200 > > I confirm that it's fixed, so closing. > > PS: I wonder why now *scratch* shows keybindings inside > non-standard quotation marks: "C-x C-f"? Why not 'C-x C-f'? > Or `C-x C-f'? I'm working on a better fix for this, which will revert back to how we were showing the bindings originally. Whether what we did originally is the best way is a separate issue. From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 16 09:40:06 2022 Received: (at 60096) by debbugs.gnu.org; 16 Dec 2022 14:40:06 +0000 Received: from localhost ([127.0.0.1]:49713 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6Bsb-0006Lu-WD for submit@debbugs.gnu.org; Fri, 16 Dec 2022 09:40:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60868) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6BsY-0006LP-Oq for 60096@debbugs.gnu.org; Fri, 16 Dec 2022 09:40: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 1p6BsS-0004hk-PT; Fri, 16 Dec 2022 09:39:56 -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=t+3CYxky2mUrsY0wEDGo8Ysr5qypLEYANcVaeFuH84M=; b=S/AvQfYf2VEu KqmeTv6GLYUjvBIpe47zXqaDZ/XRFaXeupMgevd3B5d81WvcOJ8xz4KgjcrI0aSqzOoFFSOWNYUml 62m4BfB1TzBd0hmFIG4Knulx7jrbeXpV7fSC2Me04EClp8nebCCJ2pRduWv6kUFBQUVLa7/AgG2pT kz8e9zG6jW3qC0vIO4KPU4L+lKaf/PHkqPKDuBPFemolbbqGpMHl1h8L5Au3mK/nZzluKnCDMvsxc 5gViiy73qhFAYgkcmjJTXpJxKLBXvRI9ippnAqcjWgk/ZNXy4A7O0WlWBgcOaqzeBpvTlPAiSwR+E fRGYH3l/Vq9yscxUQhAu5Q==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6BsR-0004YL-T3; Fri, 16 Dec 2022 09:39:56 -0500 Date: Fri, 16 Dec 2022 16:39:57 +0200 Message-Id: <83ilibjttu.fsf@gnu.org> From: Eli Zaretskii To: juri@linkov.net In-Reply-To: <83k02rk1vk.fsf@gnu.org> (message from Eli Zaretskii on Fri, 16 Dec 2022 13:46:07 +0200) Subject: Re: bug#60096: 29.0.60; Crash in format_mode_line_unwind_data References: <86a63oen2m.fsf@mail.linkov.net> <83sfhgjqd7.fsf@gnu.org> <86cz8jls87.fsf@mail.linkov.net> <83k02rk1vk.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60096 Cc: 60096@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: 60096@debbugs.gnu.org > Date: Fri, 16 Dec 2022 13:46:07 +0200 > From: Eli Zaretskii > > > From: Juri Linkov > > Cc: 60096-done@debbugs.gnu.org > > Date: Fri, 16 Dec 2022 09:31:36 +0200 > > > > I confirm that it's fixed, so closing. > > > > PS: I wonder why now *scratch* shows keybindings inside > > non-standard quotation marks: "C-x C-f"? Why not 'C-x C-f'? > > Or `C-x C-f'? > > I'm working on a better fix for this, which will revert back to how we > were showing the bindings originally. Whether what we did originally > is the best way is a separate issue. Now done, please re-test. Note that the *scratch* buffer is re-created in this scenario without the blurb we put into it, and in Fundamental mode. This is because get-scratch-buffer-create, which is called to re-create it (because we have no "other" buffer to switch to when the original *scratch* is killed) signals an error when it deletes the temp buffer used by substitute-command-keys. This is what happens when safe C code which can be called in situations where we literally pull ourselves by the shoestrings, is replaced by less safe Lisp code. From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 16 10:03:48 2022 Received: (at 60096) by debbugs.gnu.org; 16 Dec 2022 15:03:48 +0000 Received: from localhost ([127.0.0.1]:49874 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6CFY-0000ad-5A for submit@debbugs.gnu.org; Fri, 16 Dec 2022 10:03:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39942) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6CFW-0000aW-SF for 60096@debbugs.gnu.org; Fri, 16 Dec 2022 10:03:47 -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 1p6CFR-0003C1-Ap; Fri, 16 Dec 2022 10:03: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=IjRrV+xcbkhHyUp7gAx3zIJyFixyZkca6oWOdQEN2R8=; b=GBgHynYqyv6H KPlTVNbNVsWaJKXJPpaW88ArqOHAHPtcFU0jruOSyhnhcFc2KWa8R65dJO0wHttdrBz7ufMfgV42x AIRAPZOn0elgR0VaGLMZYUW5U+olPLtdrJmDkrQpioz18pIKbIJypWGdyiZJM1eNhuYw+qkB/6C2A JZ7nX1rKLCMMzktQ56WA4GNTfj8wKyFXgYFJ7qIASZQkXecRHjsurphMKjqHwhv5PU3bkhLrCKdzQ I0i6SMf1fb8P754Z+HygesJZn4Jla2H2SvBgfRjiJgoNHZ8LaT1SsVfzfiKzZL2mWvniC1ZKnY4GJ V6scULZloQoBvDHYc6wLIA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6CFQ-00006q-8X; Fri, 16 Dec 2022 10:03:41 -0500 Date: Fri, 16 Dec 2022 17:03:42 +0200 Message-Id: <83fsdfjsq9.fsf@gnu.org> From: Eli Zaretskii To: martin rudalics In-Reply-To: <83ilibjttu.fsf@gnu.org> (message from Eli Zaretskii on Fri, 16 Dec 2022 16:39:57 +0200) Subject: Re: bug#60096: 29.0.60; Crash in format_mode_line_unwind_data References: <86a63oen2m.fsf@mail.linkov.net> <83sfhgjqd7.fsf@gnu.org> <86cz8jls87.fsf@mail.linkov.net> <83k02rk1vk.fsf@gnu.org> <83ilibjttu.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60096 Cc: 60096@debbugs.gnu.org, juri@linkov.net 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: 60096@debbugs.gnu.org > Date: Fri, 16 Dec 2022 16:39:57 +0200 > From: Eli Zaretskii > > Note that the *scratch* buffer is re-created in this scenario without > the blurb we put into it, and in Fundamental mode. I've fixed at least the last part, so the major mode of the re-created *scratch* is now as expected. Martin, I'd appreciate your views on the changeset in commit 89f54e8157 and regarding the original problem to begin with. Basically, set-window-configuration was called in a situation where it has only one valid buffer to play with, which is tough for its logic and the various other functions it invokes. The result was a bunch of bad windows with nil as their buffer. From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 17 04:17:13 2022 Received: (at 60096) by debbugs.gnu.org; 17 Dec 2022 09:17:13 +0000 Received: from localhost ([127.0.0.1]:54770 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6TJh-0005GF-4V for submit@debbugs.gnu.org; Sat, 17 Dec 2022 04:17:13 -0500 Received: from mout.gmx.net ([212.227.17.22]:34739) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6TJf-0005G7-Gh for 60096@debbugs.gnu.org; Sat, 17 Dec 2022 04:17:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.at; s=s31663417; t=1671268624; bh=LxnIoGP1rhxlfbdQlz01POCfzBzpE1FVclLySxUE4LA=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=MZXnWsSqp5unGiHgOLI/zEBSKnjxTzQJntZrURbCP1uAQ91k6Kuj2jeo/WfUP4vZF 9EM/urtZEyMOQouYDST32+b+0xLgqnqFa16cTbA9SCJfQPkJlclQQ7yyfYYRDtyFpH x+ueqxkVUn+cgeh3nuYsKUBFK8/zjCrsfx7euQ8wVTIrwL+tLy6zmOqBfZ8oJCEmIC E+n3VP/QC/3m1nYz2mWkDOZnwjdUbV6hqB2tq31NYUeDXjndXRLLw3s4OMGIKw8d+5 F8g9mt06c2ER4ZOeP7l2UiFh9j0gkanDJz3ZcvE+DgM4abcVs+GWdwz02Vwnr9aqbu 8bG1+J5Qh2vwQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.1.102] ([212.95.5.50]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N2E1G-1out3e30X8-013bQm; Sat, 17 Dec 2022 10:17:04 +0100 Message-ID: <325aaa94-74fa-cf94-b66c-b87c69ebe386@gmx.at> Date: Sat, 17 Dec 2022 10:17:00 +0100 MIME-Version: 1.0 Subject: Re: bug#60096: 29.0.60; Crash in format_mode_line_unwind_data Content-Language: en-US To: Eli Zaretskii References: <86a63oen2m.fsf@mail.linkov.net> <83sfhgjqd7.fsf@gnu.org> <86cz8jls87.fsf@mail.linkov.net> <83k02rk1vk.fsf@gnu.org> <83ilibjttu.fsf@gnu.org> <83fsdfjsq9.fsf@gnu.org> From: martin rudalics In-Reply-To: <83fsdfjsq9.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:zd/bXLZG90sXGL0JA4y5OS/GmOhH1vYjC2+OCIUWikGajaeVYz2 s4n3o2bcC93b6NUjqKFEzaaeihVBKiobeIWOTJV2IFHiRxZsuDPGU9lSclzw/m9IJE5R95n 5m0aoaCPC0yeUlT9FWohczkY/tZOiUdOz6furuWgqN0tPPdml45HpqNxPaggieU6ql3Ec1d e5H5uE5zCvINqObJwPr1A== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:iv/1yx5SDsc=;NUdltGLj4uQcgdSX/oc7SmJsCTr vhFOx9gwBXhLNjHnON/Krn39btzBESqs5Kynnha3GUVyJitZ4ePhgGP7j0JF32I4Gr9WJbMUC YReVPf6c/71YQkkLCyiE8kZmvBkSDmRt5fi+on9Qc6o66zQ/6ELmD/OyZ6B9FGZRLPmxU6e1T MVNJisASDoLsAR8EtfMpI9BNkVkJXnvBua981LQX8azcDqhuPlNdgzTdQypgRFyhkKPRtNlgB f7pFpQCK+B48CKjsF2Dk4hfPY3ow30RsFa60bDP2mzZrrY9OuOPCXxvUZC5b6lz98e/j1A9Qy ep3Bv6Hh2WBqoK24EWuPpGgWhRLQbsiNgOGFX3W/J8lupo8wCN8g6zLX8kQacE+DQ7vqhhtwR lWWW63XVJKVJypWQzM6aaxBW0B8PBhF/mArTxT0OZsbko8ZTkiCL0UwL0DrZ8pc39q4b9wfxN Z9btOvzusbnFLGOXo04sjjCm9nf0EbfDP0wi3WgQMQgJmVYkipt5ky/EdwaKz5kyiqJNO472s uOV7AecaGblGDI77l+gJ+vMqefUSbgRTrrEiQChqFHESNnBUh5qbCDuB5tIIKSuVEbkIcr6/F oLikaHQLUASUt9g2MH9yf5ncagAxricHeljkDiDwZSTVDvjdV0D3Zhfkw2P74dff9WwY4TCNf CVciotduLaoR91sa4Qfyio9iiIctgBSc+0dx72MrDs9MVMEOUHIwKuGy4VQ56Bv05r9VGtpGE ACD41jFpaCcmXG+KxUEunuR0Zb/SVa4J07KG5V+JozxHav7pMWcLTT7GVFz8fxBG2UKIAnVfN NiwS+bL/uqWzuViZYkd7FjV6rYDrNfX8F5UKFvWSS6bwlBzcwt14k53jXLR4simTRDUozET1t /28F6payIDdmRb7tlV3Oe3ElfFqo4FoVf3ZVxmDFngAW/aGXXG6qBl/qt1dEkJsgWMJw7TPBw 6TTGOA== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60096 Cc: 60096@debbugs.gnu.org, juri@linkov.net 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.7 (-) > Basically, set-window-configuration was called in a situation where it > has only one valid buffer to play with, which is tough for its logic > and the various other functions it invokes. The result was a bunch of > bad windows with nil as their buffer. If a live window has nil as its buffer, next redisplay will reliably crash Emacs anyway. So this /* We may have deleted windows above. Then again, maybe we haven't: the functions we call to maybe delete windows can decide a window cannot be deleted. Force recalculation of Vwindow_list next time it is needed, to make sure stale windows with no buffers don't escape into the wild, which will cause crashes elsewhere. */ Vwindow_list = Qnil; should not be needed. Otherwise we'd have been in serious trouble ever since Vwindow_list was added. The earlier call delete_all_child_windows (FRAME_ROOT_WINDOW (f)); should have reliably reset Vwindow_list to nil. martin From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 17 05:00:59 2022 Received: (at 60096) by debbugs.gnu.org; 17 Dec 2022 10:00:59 +0000 Received: from localhost ([127.0.0.1]:54955 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6U03-0005rH-6N for submit@debbugs.gnu.org; Sat, 17 Dec 2022 05:00:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55404) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6Tzz-0005r9-Iv for 60096@debbugs.gnu.org; Sat, 17 Dec 2022 05:00: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 1p6Tzu-00077z-4B; Sat, 17 Dec 2022 05:00:50 -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=Vcym+KB32fzazwrXGx5bbS02TqKZUjrt6jKke1yqwcU=; b=E0k2yD5gMKSx b89qJrNWPCA+B1wzWv22UxHjatnbgiKmgUDwUr9i6t5yO9lMtnGoYE+Ff0nPHOBAgJ8CkiV5xiZY8 UvIA6bFwGsGYEQpfWs8uJTtC8a4yWmQSYlmRZXRDEq45+kihoOUz8Z1AoF+xILt0gRHkc0RyeKCZi /q+VaRuwneiYKoGqRr+3jqD68aZzKmS0A6b6nzuSIS2/Xm3oD2tTWs0mDDnOsKt6VKbixBJoIddCy rISehKpBcth21fgH78dHODzdS2CNqPBOWcA+fykpcjTQ44nBcQR363BnGOxdpU3asSE9kmbVueipP VTXwvq01A+fsBcN6Agr05Q==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6Tzn-0003ym-6N; Sat, 17 Dec 2022 05:00:48 -0500 Date: Sat, 17 Dec 2022 12:00:47 +0200 Message-Id: <838rj6ic34.fsf@gnu.org> From: Eli Zaretskii To: martin rudalics In-Reply-To: <325aaa94-74fa-cf94-b66c-b87c69ebe386@gmx.at> (message from martin rudalics on Sat, 17 Dec 2022 10:17:00 +0100) Subject: Re: bug#60096: 29.0.60; Crash in format_mode_line_unwind_data References: <86a63oen2m.fsf@mail.linkov.net> <83sfhgjqd7.fsf@gnu.org> <86cz8jls87.fsf@mail.linkov.net> <83k02rk1vk.fsf@gnu.org> <83ilibjttu.fsf@gnu.org> <83fsdfjsq9.fsf@gnu.org> <325aaa94-74fa-cf94-b66c-b87c69ebe386@gmx.at> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60096 Cc: 60096@debbugs.gnu.org, juri@linkov.net 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 (---) > Date: Sat, 17 Dec 2022 10:17:00 +0100 > Cc: juri@linkov.net, 60096@debbugs.gnu.org > From: martin rudalics > > > Basically, set-window-configuration was called in a situation where it > > has only one valid buffer to play with, which is tough for its logic > > and the various other functions it invokes. The result was a bunch of > > bad windows with nil as their buffer. > > If a live window has nil as its buffer, next redisplay will reliably > crash Emacs anyway. So this > > /* We may have deleted windows above. Then again, maybe we > haven't: the functions we call to maybe delete windows can > decide a window cannot be deleted. Force recalculation of > Vwindow_list next time it is needed, to make sure stale > windows with no buffers don't escape into the wild, which > will cause crashes elsewhere. */ > Vwindow_list = Qnil; > > should not be needed. It is needed in this case because it forces redisplay to recompute the window list (in propagate_buffer_redisplay, if not earlier). If the above is not done, Vwindow_list will be reused, and the problematic (bogus?) windows in it _will_ cause a crash. > The earlier call > > delete_all_child_windows (FRAME_ROOT_WINDOW (f)); > > should have reliably reset Vwindow_list to nil. AFAIR, the code which runs after that call recalculated Vwindow_list, adding to it those windows with no buffer. You should be able to see that by running the simple recipe posted by Juri at the beginning of this bug report. What about the other parts of the changeset I installed -- do they look okay to you? any comments? From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 17 05:53:31 2022 Received: (at 60096) by debbugs.gnu.org; 17 Dec 2022 10:53:32 +0000 Received: from localhost ([127.0.0.1]:55182 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6Uot-0006T8-HA for submit@debbugs.gnu.org; Sat, 17 Dec 2022 05:53:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48358) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6Uos-0006T2-En for 60096@debbugs.gnu.org; Sat, 17 Dec 2022 05:53:31 -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 1p6Uol-0007t6-Du; Sat, 17 Dec 2022 05:53: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=Wx+wxoGNpos/h41gDKls/7Ql55vuSzCBGFTwMGwuca8=; b=GvQXZUnLqgiK 73a9peC8p3KVZjVZ9V6LG4ZPUk5tJUrEwXZbK3dzAAHRz6HrIytDmC/Rb3+gJd3oFopicHqI4TT8k 6DnulwRtgMAKqPDFh4xRoUKLJS1erDnxIwfQyrig69xUk7P6ocwSNfGwXv4QUR0XH3KHAzuOqbEPc fi59qq+uEIRfHz1KLFoAk7LT/Pp+Dt7+sAbGeZxiruczbMBxezPBamRTUnCHTuBVvxY0MmdVb3Ujm OjgBNRSUxHd1pi8SDtNnftToeATxNjF2Tkiytl29pAZgkZ+768xf9xbXyRAxkKOSaLLcX9aJ51hTr /tpf6LjfrOpzjI0IGk96yQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6Uoj-0006v4-T7; Sat, 17 Dec 2022 05:53:22 -0500 Date: Sat, 17 Dec 2022 12:53:26 +0200 Message-Id: <834jtui9nd.fsf@gnu.org> From: Eli Zaretskii To: rudalics@gmx.at In-Reply-To: <838rj6ic34.fsf@gnu.org> (message from Eli Zaretskii on Sat, 17 Dec 2022 12:00:47 +0200) Subject: Re: bug#60096: 29.0.60; Crash in format_mode_line_unwind_data References: <86a63oen2m.fsf@mail.linkov.net> <83sfhgjqd7.fsf@gnu.org> <86cz8jls87.fsf@mail.linkov.net> <83k02rk1vk.fsf@gnu.org> <83ilibjttu.fsf@gnu.org> <83fsdfjsq9.fsf@gnu.org> <325aaa94-74fa-cf94-b66c-b87c69ebe386@gmx.at> <838rj6ic34.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60096 Cc: 60096@debbugs.gnu.org, juri@linkov.net 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: 60096@debbugs.gnu.org, juri@linkov.net > Date: Sat, 17 Dec 2022 12:00:47 +0200 > From: Eli Zaretskii > > > The earlier call > > > > delete_all_child_windows (FRAME_ROOT_WINDOW (f)); > > > > should have reliably reset Vwindow_list to nil. > > AFAIR, the code which runs after that call recalculated Vwindow_list, > adding to it those windows with no buffer. Specifically, here's what happens: . We call wset_buffer (w, other_buffer_safely (Fcurrent_buffer ())); . other_buffer_safely cannot find a single buffer that satisfies the candidate_buffer condition, so it ends up recreating *scratch* (whose deletion caused this mess to begin with) by calling get-scratch-buffer-create in Lisp . get-scratch-buffer-create calls substitute-command-keys to produce the blurb we put in the comment at the beginning of *scratch* . substitute-command-keys uses a temporary buffer to format the message, and calls kill-buffer to delete that buffer when it's done . kill-buffer calls replace_buffer_in_windows, which calls replace-buffer-in-windows in Lisp . replace-buffer-in-windows calls window-list-1, which calls window_list, which fills Vwindow_list with windows that have no buffer: (gdb) pp Vwindow_list (# #) . one of these windows gets assigned a buffer, eventually, since it's a selected-window, but the other window stays without a buffer, and causes a crash in the following redisplay From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 17 10:26:46 2022 Received: (at 60096) by debbugs.gnu.org; 17 Dec 2022 15:26:46 +0000 Received: from localhost ([127.0.0.1]:56461 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6Z5K-00024s-9C for submit@debbugs.gnu.org; Sat, 17 Dec 2022 10:26:46 -0500 Received: from mout.gmx.net ([212.227.15.19]:60041) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6Z5I-00024l-1H for 60096@debbugs.gnu.org; Sat, 17 Dec 2022 10:26:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.at; s=s31663417; t=1671290797; bh=zbil+qj1zwmOCjCYf6JkOJlP+xfFiuBdKGFZOnoMHT8=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=WYFZ1CwMBbk20IlchQldb4nYqDwslevx8vWritoXduJHg14XOxSh4KWuZr5GXRNWF JmNk+SjTKFsU50FQXpRNOdbPJWOEZ00Cv91A1/wqkaoncXtLOGRgFHX0/D8K7N+uHb cKiI3jjAhguyJm10Jqqea0H0fIIwdha/C28kCVErLDwrvDnBgU2Y7HRMea+zIdKD4W PYWnVSTQO4L+AiVWofZfBV8NOKz+1onk7wyxJWXWxiMmmCW9EZhEpvJxnbziLKGuvB k18Nt3nW/Zl4rv3sxby20JM2Nnz7tLQyc6iAfVlKa8Kn6wywWKceopYr8uhLc9Zpg9 zqkoEoctzRXqw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.1.102] ([212.95.5.50]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M9FjR-1p1Jco2d2F-006PcC; Sat, 17 Dec 2022 16:26:37 +0100 Message-ID: Date: Sat, 17 Dec 2022 16:26:36 +0100 MIME-Version: 1.0 Subject: Re: bug#60096: 29.0.60; Crash in format_mode_line_unwind_data Content-Language: en-US To: Eli Zaretskii References: <86a63oen2m.fsf@mail.linkov.net> <83sfhgjqd7.fsf@gnu.org> <86cz8jls87.fsf@mail.linkov.net> <83k02rk1vk.fsf@gnu.org> <83ilibjttu.fsf@gnu.org> <83fsdfjsq9.fsf@gnu.org> <325aaa94-74fa-cf94-b66c-b87c69ebe386@gmx.at> <838rj6ic34.fsf@gnu.org> From: martin rudalics In-Reply-To: <838rj6ic34.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:DY9Vr4gyPAj6Xa8dIP8wLw/xrNX+pbuPWGLtedv/oZxQ3JUB7V9 7K1O7DvHaiFkeqw/QhzCgiPCEu1eYThAC+v3mu1cadeAbumqgzhEaOXUZtWj7g4kTPGDQI8 uhwnRsxbpPvIiMekT8m2OnXNF9PB9QhUYnQVy0EKPFkhyfn+dOFilSEjpk2JFURuLvHcBMC LAPIPKpTfudjBVZ8cjj2A== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:xdVseGd9Dy0=;mythaDHQff5rTToWYQ6SjVrTzS1 MVcZObCiUQbVo9Rh71FSJuQKOzvBOSw1bOEJOuH/XECIpYljte931MEBZ6k5zCmFzu+X+pHzE uSXtTaXaZautCjObx/XPtK+XA0+7mXUIZZV9Gr+gfro765SC2enS10+gz6MFcKmk1I+0prJDh 9cOiQrzwQlEpabPH9phHeZTZfSQMp6xRi7E0p8duwrMvIhdCramvra30dpBPLI1FalckWmrgj SY562rVZwxh8P7A0AH2w96+T6LkqZbd7tSxk6tKtzUwZ0Nbi64p4Dsf9TawpRSRaUNJVwGTPJ PmCSPI5EGIV0hinIhXiHUOV+8EL6pzPIZ0mtoFfI3DXTTZ4Udk/nPO9MT3mhzIjKdqrgotowV Jg/qDGF4pl7T1yQgrzk3JDtB+nYt3axMfHy8w0tTzRtoMlxNsF7rfkuzUbsmDUuw3uRUUJF2J 0/9Uu3RFWMFLeYSmpnzQy8G+wFrP5W3sGGLW9mAW5Kq1H2gEoFXEdWbJqslV8dsG/FETgGism mXuntiTYgHgBxSf5NdgvnTXVeni5Pzu3G8QtHsLuKAOHGaqmf8WRK2eJwMBeUvWMSaBY2O69/ YGqMYF0MIBU73PXybJLrAUPfXtQ80v6qoJMbFMGiEW8lFsydPIDSB1lHJ1ktgqtFVi/bnmrgM UGI7hpxBwnU+wAsjgj5V/UbJJkvMfrdHe/IxOfMrbFwmSDq/tetQVUdlAo2UjRHRvGc3lCMpt 3OCZ76I3R/hDlo1dII+pBY4JRBVP5fTK7v0tU/e3ujrTfi5muVjV6L7qKxYE8tqirsMUOzdm5 n6mH3b22rBuiYwt7XcrfqwKI5wIDDRKn+cWq68NNgdshBgckIuoYPmswpPOkMpyD98F1+MNDc MwbPWYgdJeAMjkcPh1B/M7CD5GBKH2IHncU542AorYCMMhGanUCDdQaQMBb+xLIilyqHdaE7n fF+tng== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60096 Cc: 60096@debbugs.gnu.org, juri@linkov.net 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.7 (-) > It is needed in this case because it forces redisplay to recompute the > window list (in propagate_buffer_redisplay, if not earlier). If the > above is not done, Vwindow_list will be reused, and the problematic > (bogus?) windows in it _will_ cause a crash. > > Specifically, here's what happens: > > . We call > > wset_buffer (w, other_buffer_safely (Fcurrent_buffer ())); > > . other_buffer_safely cannot find a single buffer that satisfies the > candidate_buffer condition, so it ends up recreating *scratch* > (whose deletion caused this mess to begin with) by calling > get-scratch-buffer-create in Lisp > . get-scratch-buffer-create calls substitute-command-keys to produce > the blurb we put in the comment at the beginning of *scratch* > . substitute-command-keys uses a temporary buffer to format the > message, and calls kill-buffer to delete that buffer when it's done > . kill-buffer calls replace_buffer_in_windows, which calls > replace-buffer-in-windows in Lisp > . replace-buffer-in-windows calls window-list-1, which calls > window_list, which fills Vwindow_list with windows that have no > buffer: > > (gdb) pp Vwindow_list > (# #) > > . one of these windows gets assigned a buffer, eventually, since it's > a selected-window, but the other window stays without a buffer, and > causes a crash in the following redisplay Thanks for the explanation. I must have tested with my own version of 'replace-buffer-in-windows' which starts with (let ((buffer (window-normalize-buffer buffer-or-name))) ;; Don't scan 'window-list-1' unless necessary (often it isn't, for ;; example, when killing a temporary buffer). (when (> (buffer-windows-count buffer) 0) (dolist (window (window-list-1 nil nil t)) But since there's no guarantee that a temporary buffer will not be shown in a window temporarily, your patch is a bit safer. Alternatively, we could exclude windows with a nil buffer in add_window_to_list (think of the case that within the blurb producing code someone wants to consult the window list). In either case, we'd be accepting a temporarily broken basic invariant - that a live window always shows a live buffer. Principally, we should never run 'replace-buffer-in-windows' from within 'set-window-configuration'. That bloated window list is just the tip of an iceberg here. > What about the other parts of the changeset I installed -- do they > look okay to you? any comments? I see - return safe_call (1, Qget_scratch_buffer_create); + /* This function must return a valid buffer, since it is frequently + our last line of defense in the face of the expected buffers + becoming dead under our feet. safe_call below could return nil + if recreating *scratch* in Lisp, which does some fancy stuff, + signals an error in some weird use case. */ + buf = safe_call (1, Qget_scratch_buffer_create); + if (NILP (buf)) + { + AUTO_STRING (scratch, "*scratch*"); + buf = Fget_buffer_create (scratch, Qnil); + } + return buf; and + Fset_buffer_major_mode (buf); which look okay to me. Unless, again, the latter would try to deal with the window list or do some other nasty stuff. Then other_buffer_safely should not be allowed to recreate *scratch* but rather some fallback buffer in fundamental mode with no hooks run and any buffer lists having it as single element. martin From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 17 10:59:44 2022 Received: (at 60096) by debbugs.gnu.org; 17 Dec 2022 15:59:44 +0000 Received: from localhost ([127.0.0.1]:56623 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6ZbE-0002Q5-8m for submit@debbugs.gnu.org; Sat, 17 Dec 2022 10:59:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46100) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6ZbD-0002Py-FB for 60096@debbugs.gnu.org; Sat, 17 Dec 2022 10:59:43 -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 1p6Zb2-0002kn-8k; Sat, 17 Dec 2022 10:59: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=qDVU6uDnAZ8SK7DxYNFlMl2lHseOlBlD8KWrqoyRTVY=; b=VYi13oQA5DjW fkjaNx0CJ39i2OjpjTTyp4NVoPTpGXlw2EC2uVKldL6KK9hXFMVQRRfTKdlw/vrh29hbfUobWousQ Ks9tuZxp85dri3ZlYQPtf9eWU0E8Ipv6PZgOpFDkFcKC2A+pIbC292XuwjxogD4nEhlT8E7SFI8pt BFpCvQ7tTwqtLXLkDbKCoJeY90gR4CzhS8moIe6fYw8I9LCziXEQa59a90BYBbFHmrvuVL53DyPX+ b0RAFk+Z9eB9KKzJX9aEH6NdCZSCpB6u1mLxD9AzfOFjp/Ovgg54BSPrgZUBrT5d1Ig6eb+mFP3TF F6hmQAqirqOCbzK2AIacpQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6Zb1-0008D3-Mz; Sat, 17 Dec 2022 10:59:32 -0500 Date: Sat, 17 Dec 2022 17:59:36 +0200 Message-Id: <83pmciggwn.fsf@gnu.org> From: Eli Zaretskii To: martin rudalics In-Reply-To: (message from martin rudalics on Sat, 17 Dec 2022 16:26:36 +0100) Subject: Re: bug#60096: 29.0.60; Crash in format_mode_line_unwind_data References: <86a63oen2m.fsf@mail.linkov.net> <83sfhgjqd7.fsf@gnu.org> <86cz8jls87.fsf@mail.linkov.net> <83k02rk1vk.fsf@gnu.org> <83ilibjttu.fsf@gnu.org> <83fsdfjsq9.fsf@gnu.org> <325aaa94-74fa-cf94-b66c-b87c69ebe386@gmx.at> <838rj6ic34.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60096 Cc: 60096@debbugs.gnu.org, juri@linkov.net 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 (---) > Date: Sat, 17 Dec 2022 16:26:36 +0100 > Cc: juri@linkov.net, 60096@debbugs.gnu.org > From: martin rudalics > > Alternatively, we could exclude windows with a nil buffer in > add_window_to_list (think of the case that within the blurb > producing code someone wants to consult the window list). Maybe we should try this on master. I indeed expected add_window_to_list to filter such invalid windows and was surprised that it didn't. Basically, I don't understand how we never had such windows in the list before, since there's no code which actively removes them and thus protects the list from holding such windows. I think we just have been lucky. > Principally, we should never run 'replace-buffer-in-windows' from within > 'set-window-configuration'. This can no longer be guaranteed, given that other_buffer_safely calls into Lisp, and so do a few other primitives. > > What about the other parts of the changeset I installed -- do they > > look okay to you? any comments? > > I see > > - return safe_call (1, Qget_scratch_buffer_create); > + /* This function must return a valid buffer, since it is frequently > + our last line of defense in the face of the expected buffers > + becoming dead under our feet. safe_call below could return nil > + if recreating *scratch* in Lisp, which does some fancy stuff, > + signals an error in some weird use case. */ > + buf = safe_call (1, Qget_scratch_buffer_create); > + if (NILP (buf)) > + { > + AUTO_STRING (scratch, "*scratch*"); > + buf = Fget_buffer_create (scratch, Qnil); > + } > + return buf; > > and > > + Fset_buffer_major_mode (buf); > > which look okay to me. Unless, again, the latter would try to deal with > the window list or do some other nasty stuff. Then other_buffer_safely > should not be allowed to recreate *scratch* but rather some fallback > buffer in fundamental mode with no hooks run and any buffer lists having > it as single element. You are right in principle, but other_buffer_safely was doing the above for many years before we acquired get-scratch-buffer-create and started calling it from here. So I think we are relatively safe (again, maybe by pure chance). Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 17 12:06:11 2022 Received: (at 60096) by debbugs.gnu.org; 17 Dec 2022 17:06:11 +0000 Received: from localhost ([127.0.0.1]:56933 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6adX-0005Q9-9t for submit@debbugs.gnu.org; Sat, 17 Dec 2022 12:06:11 -0500 Received: from mout.gmx.net ([212.227.15.18]:36755) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6adS-0005Pl-Da for 60096@debbugs.gnu.org; Sat, 17 Dec 2022 12:06:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.at; s=s31663417; t=1671296759; bh=SVqvj78ZGSXYXrYJNqQ/p6h6FVcTXM5G60PN/LDgcww=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=L44PrlnrHjQb9EGIoZdBjDioEInrUjMIbtJo2/l5O7skpAAD/8xjWMAB4KKuGMhwF r3G/SYr4iQuOjQEaQKuX2tfxOygopabpWmatEYG3hxFhHzC3BxUqbJIwF+c/wqRUde STXFgQF4ihRLR4HD59fnscK4WxS68DbhvpzHx0r1pTKSzErq0ge47BlSUHPvot6qTp xwwmyBnBUE+nRws94OHQ601qOBIe5oDSMwLLsCpxx4X3nLeY61na/0Fe6eJcQU7XiF NhOqcwzm/Ed71CZ6iSAsv1SBDcAhEQ0iuw73MvhHNIyscHP1gBr5/vEruQGT6u7jjd /fYiesf7YFctQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.1.102] ([212.95.5.50]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mw9Q6-1ongCh2KV2-00s3EQ; Sat, 17 Dec 2022 18:05:59 +0100 Message-ID: <89b63947-5b2d-8bd1-4e9a-7da6cf114ffe@gmx.at> Date: Sat, 17 Dec 2022 18:05:58 +0100 MIME-Version: 1.0 Subject: Re: bug#60096: 29.0.60; Crash in format_mode_line_unwind_data Content-Language: en-US To: Eli Zaretskii References: <86a63oen2m.fsf@mail.linkov.net> <83sfhgjqd7.fsf@gnu.org> <86cz8jls87.fsf@mail.linkov.net> <83k02rk1vk.fsf@gnu.org> <83ilibjttu.fsf@gnu.org> <83fsdfjsq9.fsf@gnu.org> <325aaa94-74fa-cf94-b66c-b87c69ebe386@gmx.at> <838rj6ic34.fsf@gnu.org> <83pmciggwn.fsf@gnu.org> From: martin rudalics In-Reply-To: <83pmciggwn.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:UVgMkNDbuIZrI4BYKrbz+BGmYZuSUHCxM2pgUnpQ8ruBGJC8muw 5g1tod1MlahnV3//qSQdIcEU7QfdDAddLpgCBQAHRA20qVstp+w/cgFMo+J2B/cDFljpCce JBM/5KBMggUnzjto3t0ikZHeqaJYa8UyJ61FKAVeH0dY0FimEsfubMA+v8oraeTDFXan/eQ l3CtCJ9HDN4QvVfpCuwGA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:/MaH+kKmJrE=;cYJFvKvU6mc1BuhnZrGxRMDA5XA uBCVLOyvY3dPerYhgyKHV3fOlbYucunng+8NTLL/W2t3pnhrKK7qvV49X4f1kkIJL4heD8iOD 2ZqhzRTnTbw5/rf/+kw3KL+ueM9XzRnQElYCA40czV3v7g1DvS8utnA3hEUEfrclaD0SUIR43 waTxCO0wK0GoPMP7qm/R69UUpXKHAnMQViWwEKLe9ZB6hFEdaez2hGbNZebRZMz1GDtamK64N holktzchGiq90YRITdt7bjIrdXYk56ep4qjx4UUQqLmSgD6E/jt4IVaFOHUsAeEe3Dp4PVIjI YkuDvraxyTlCvv/4pe1KYAzgk/ad/0dP+hdpHekxIw76uiZeoObqLmTF9wFqhlTGoGs2McZwu uoL7wYq2SCnUSAHZr3z3PQwrbl+uVznpBr1GtFIXlKUUPOy5fnZojXVqjuJZ0xb1bXtOAa2le BimmLHLfZffiogCHANwFXDomYyPyMhx0MnzD94QtaBfYyrWrxP8sfxpmHhLhjIv61AZ5frIJc TGBASINOvog4w3yizIBgWxYEZ8BmMYxawUb3qsnwneyfuwBSGPUHJ5gFNzSHXZfsAw0/nMol4 8Y9vugxKwdtI3J8aPPSYOqT0F9TPcJC781sKyk36Xyy8qqpKaUiV5l+5oi9cbjKPmgeZOne1D mzi5Vp1EhDOec2orBU0D3n5WGmp5gb+JE3TydVx5AlPy9cPV4Al8agMP9wZP8TWisuGafm9Hb Szzo28RWfAlFpt762ZpLSnaFsDLcDpuxpOoN6gtIZx+IzZOP1dIG040eYrWJ9eRVMLYcfs7oR m86UJ7waoU2aYjBGSkeWHhTusVvfq/z7HJYOYajTEkrLoP02+qjRr6823tJ/RIbsJbYnYJQe9 WIZ/WlEMjCoEpMFIM/HxJtxX4hfaYwZNIn6swkIJJwo64oSKsGkO2rfSRL+H91k6F6bS9peF4 Eu9Y9NlCwWSQPQwl6Qk+PtkqYBw= X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60096 Cc: 60096@debbugs.gnu.org, juri@linkov.net 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.7 (-) >> Alternatively, we could exclude windows with a nil buffer in >> add_window_to_list (think of the case that within the blurb >> producing code someone wants to consult the window list). > > Maybe we should try this on master. I indeed expected > add_window_to_list to filter such invalid windows and was surprised > that it didn't. Basically, I don't understand how we never had such > windows in the list before, since there's no code which actively > removes them and thus protects the list from holding such windows. I > think we just have been lucky. Probably so far we never tried to call 'kill-buffer' from within 'set-window-configuration'. If the only "live" window shows *scratch*, *scratch* gets killed and we kill a temporary buffer before we were able to recreate *scratch*, window_list will return the empty list. >> Principally, we should never run 'replace-buffer-in-windows' from within >> 'set-window-configuration'. > > This can no longer be guaranteed, given that other_buffer_safely calls > into Lisp, and so do a few other primitives. What if such a call into Lisp tries to run 'set-window-configuration'? > You are right in principle, but other_buffer_safely was doing the > above for many years before we acquired get-scratch-buffer-create and > started calling it from here. So I think we are relatively safe > (again, maybe by pure chance). Then not calling 'get-scratch-buffer-create' from other_window_safely would be more safe. martin From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 17 12:27:59 2022 Received: (at 60096) by debbugs.gnu.org; 17 Dec 2022 17:27:59 +0000 Received: from localhost ([127.0.0.1]:57039 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6ayd-0005e0-Eb for submit@debbugs.gnu.org; Sat, 17 Dec 2022 12:27:59 -0500 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:43187) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6ayc-0005dh-97 for 60096@debbugs.gnu.org; Sat, 17 Dec 2022 12:27:58 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 2749160005; Sat, 17 Dec 2022 17:27:48 +0000 (UTC) From: Juri Linkov To: Eli Zaretskii Subject: Re: bug#60096: 29.0.60; Crash in format_mode_line_unwind_data In-Reply-To: <83fsdfjsq9.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 16 Dec 2022 17:03:42 +0200") Organization: LINKOV.NET References: <86a63oen2m.fsf@mail.linkov.net> <83sfhgjqd7.fsf@gnu.org> <86cz8jls87.fsf@mail.linkov.net> <83k02rk1vk.fsf@gnu.org> <83ilibjttu.fsf@gnu.org> <83fsdfjsq9.fsf@gnu.org> Date: Sat, 17 Dec 2022 19:23:27 +0200 Message-ID: <86fsdeymeo.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60096 Cc: 60096@debbugs.gnu.org, martin rudalics 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.7 (-) >> Note that the *scratch* buffer is re-created in this scenario without >> the blurb we put into it, and in Fundamental mode. > > I've fixed at least the last part, so the major mode of the re-created > *scratch* is now as expected. Now it doesn't crash, but outputs an error in the *Messages* buffer: Error during redisplay: (get-scratch-buffer-create) signaled (wrong-type-argument window-live-p #) From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 17 12:52:15 2022 Received: (at 60096) by debbugs.gnu.org; 17 Dec 2022 17:52:16 +0000 Received: from localhost ([127.0.0.1]:57152 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6bM7-0008FJ-GN for submit@debbugs.gnu.org; Sat, 17 Dec 2022 12:52:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39522) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6bM5-0008F9-MG for 60096@debbugs.gnu.org; Sat, 17 Dec 2022 12:52:14 -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 1p6bLz-0006Wt-Oj; Sat, 17 Dec 2022 12:52:07 -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=U04tWcTtslGlWZzQSBuvDFaYNAGqh5qe2svYjncH6Ic=; b=gAFUKD07J26j RuplE6aZEQbvCBFsJDnXpw8rr5kADUksO1H5yHOAqAXTUph1j+QeuZmdxB0V7bGpxpgI0vHdG4l0C KDDqyylPk+KSj0AQol5g/fQZmc6muOvuNhJ0Z1e5r8akgpXzgl2Po41zI6AqHJ+E/N9QMVyYu5k7V QJrvVBEbQNnGYUXpl7AN3rHfgTMv8tj52HgB3x1K8Fwkz5x6oyIb5I97om4j4N5srFk0GGHUrOgSf jDuuFZPoqoGgPRU4rlh99fr/Xu+wwo3+hmO0h6Wq0H6DhMiKCTYtmQ7opCtj6mUvx2/s/cFd5d4RH Br6VWROGjRSlQc08sWomTw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6bLy-0003wR-Uc; Sat, 17 Dec 2022 12:52:07 -0500 Date: Sat, 17 Dec 2022 19:52:12 +0200 Message-Id: <83edsxhq9f.fsf@gnu.org> From: Eli Zaretskii To: martin rudalics In-Reply-To: <89b63947-5b2d-8bd1-4e9a-7da6cf114ffe@gmx.at> (message from martin rudalics on Sat, 17 Dec 2022 18:05:58 +0100) Subject: Re: bug#60096: 29.0.60; Crash in format_mode_line_unwind_data References: <86a63oen2m.fsf@mail.linkov.net> <83sfhgjqd7.fsf@gnu.org> <86cz8jls87.fsf@mail.linkov.net> <83k02rk1vk.fsf@gnu.org> <83ilibjttu.fsf@gnu.org> <83fsdfjsq9.fsf@gnu.org> <325aaa94-74fa-cf94-b66c-b87c69ebe386@gmx.at> <838rj6ic34.fsf@gnu.org> <83pmciggwn.fsf@gnu.org> <89b63947-5b2d-8bd1-4e9a-7da6cf114ffe@gmx.at> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60096 Cc: 60096@debbugs.gnu.org, juri@linkov.net 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 (---) > Date: Sat, 17 Dec 2022 18:05:58 +0100 > Cc: juri@linkov.net, 60096@debbugs.gnu.org > From: martin rudalics > > >> Alternatively, we could exclude windows with a nil buffer in > >> add_window_to_list (think of the case that within the blurb > >> producing code someone wants to consult the window list). > > > > Maybe we should try this on master. I indeed expected > > add_window_to_list to filter such invalid windows and was surprised > > that it didn't. Basically, I don't understand how we never had such > > windows in the list before, since there's no code which actively > > removes them and thus protects the list from holding such windows. I > > think we just have been lucky. > > Probably so far we never tried to call 'kill-buffer' from within > 'set-window-configuration'. If the only "live" window shows *scratch*, > *scratch* gets killed and we kill a temporary buffer before we were able > to recreate *scratch*, window_list will return the empty list. Why the empty list? The buffer gets killed, but windows don't get killed. We still have the frame with at least two windows (including the mini-window). Right? > >> Principally, we should never run 'replace-buffer-in-windows' from within > >> 'set-window-configuration'. > > > > This can no longer be guaranteed, given that other_buffer_safely calls > > into Lisp, and so do a few other primitives. > > What if such a call into Lisp tries to run 'set-window-configuration'? Indeed. Maybe we should protect set-window-configuration from being re-entered? > > You are right in principle, but other_buffer_safely was doing the > > above for many years before we acquired get-scratch-buffer-create and > > started calling it from here. So I think we are relatively safe > > (again, maybe by pure chance). > > Then not calling 'get-scratch-buffer-create' from other_window_safely > would be more safe. You mean, return to what we did before get-scratch-buffer-create was invented? It's possible. From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 17 12:59:34 2022 Received: (at 60096) by debbugs.gnu.org; 17 Dec 2022 17:59:34 +0000 Received: from localhost ([127.0.0.1]:57197 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6bTC-0008JY-9e for submit@debbugs.gnu.org; Sat, 17 Dec 2022 12:59:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44498) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6bTB-0008JS-4H for 60096@debbugs.gnu.org; Sat, 17 Dec 2022 12:59: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 1p6bT4-0007hm-U5; Sat, 17 Dec 2022 12:59:26 -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=nEoTmJxk9H04DOPT3NNv5vj2D4JouRgMLuEkMFeyaJY=; b=mPa1mEfkILCg nWgX2GH22yp9HONZQTmhfdrmFJhU8T1SVRGdDlYWaf5bhA5fjr/sRPevO9Wadkl/GUyvO/7y2NoUX hYEef0PbgSD3ZnmUPRMv0bxWKh5kJwQbTIQdYY2wRJJXeOLfRrDUWpgdW1EvETV1B2pz2V+aVva2x Gy4Ii1SUt+RGV8zfRaXdOCFdOilAoZhxc4PwZxWJ5EigBzbp3piJUCCU89GDjutijj/ignnz5nmiC 9KEnSCYmNtfEnF4cmB+1lvlhEfM1xU3dHrWTVps/Q3ykyr0+ZQZlCz5MO54oJJJAoZcZ1rGvs2GJ2 N0OiEn6RXMhqV0jEG95wwg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6bT4-0000Wm-69; Sat, 17 Dec 2022 12:59:26 -0500 Date: Sat, 17 Dec 2022 19:59:31 +0200 Message-Id: <83a63lhpx8.fsf@gnu.org> From: Eli Zaretskii To: Juri Linkov In-Reply-To: <86fsdeymeo.fsf@mail.linkov.net> (message from Juri Linkov on Sat, 17 Dec 2022 19:23:27 +0200) Subject: Re: bug#60096: 29.0.60; Crash in format_mode_line_unwind_data References: <86a63oen2m.fsf@mail.linkov.net> <83sfhgjqd7.fsf@gnu.org> <86cz8jls87.fsf@mail.linkov.net> <83k02rk1vk.fsf@gnu.org> <83ilibjttu.fsf@gnu.org> <83fsdfjsq9.fsf@gnu.org> <86fsdeymeo.fsf@mail.linkov.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60096 Cc: 60096@debbugs.gnu.org, rudalics@gmx.at 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: Juri Linkov > Cc: martin rudalics , 60096@debbugs.gnu.org > Date: Sat, 17 Dec 2022 19:23:27 +0200 > > >> Note that the *scratch* buffer is re-created in this scenario without > >> the blurb we put into it, and in Fundamental mode. > > > > I've fixed at least the last part, so the major mode of the re-created > > *scratch* is now as expected. > > Now it doesn't crash, but outputs an error in the *Messages* buffer: > > Error during redisplay: (get-scratch-buffer-create) > signaled (wrong-type-argument window-live-p #) Only once, right? This is the error which (indirectly) caused the crash you reported originally. The fix just falls back on a safer method of re-creating *scratch* when this error happens. It is a very unusual situation that *scratch* needs to be re-created when we call set-window-configuration; it is caused by the fact that your recipe kills one of the two only buffers Emacs has to play around (the other one being *Messages*). From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 18 04:18:32 2022 Received: (at 60096) by debbugs.gnu.org; 18 Dec 2022 09:18:32 +0000 Received: from localhost ([127.0.0.1]:32838 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6poW-0006Cw-G0 for submit@debbugs.gnu.org; Sun, 18 Dec 2022 04:18:32 -0500 Received: from mout.gmx.net ([212.227.17.22]:51687) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6poU-0006Cq-Q6 for 60096@debbugs.gnu.org; Sun, 18 Dec 2022 04:18:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.at; s=s31663417; t=1671355102; bh=SKM9NFTqCFp5j6R4SDjlF2oFo25cIgNimMN9QpsjiTM=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=O3HXrR5s0Ez3tu4leK9ZlMNnaRWt6Aw3CTIIK8ropod6bzY8579XbwVxRr6auEJYr py9kT9fJGBScuQlT1zqfHO7kusahDS2abA7oDfYvs9p66I/QMK0LSPhDa5iwyGYLb+ RneeopwikG/Z25TBJGuysQ5qoebF/L9ExT5CskbBYqvT1Bvr94RMf41f4E2byLTn/m lI665jn3uoBZDBZUvkDtaZ+cYEmqwag3Y2Y6ylSzCqd+IjADUIc08Bbr+3Aq2ll6V/ DP4vybOZFiZuikYYeDq0M6YjfSAoItTIYLRXcUHkJQBB1Z3JYtQiU2B3GdNyHXQlsi jEONxpn5sDwaw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.1.100] ([212.95.5.117]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N6bjy-1opabo0ORK-017z7d; Sun, 18 Dec 2022 10:18:22 +0100 Message-ID: Date: Sun, 18 Dec 2022 10:18:18 +0100 MIME-Version: 1.0 Subject: Re: bug#60096: 29.0.60; Crash in format_mode_line_unwind_data Content-Language: en-US To: Eli Zaretskii References: <86a63oen2m.fsf@mail.linkov.net> <83sfhgjqd7.fsf@gnu.org> <86cz8jls87.fsf@mail.linkov.net> <83k02rk1vk.fsf@gnu.org> <83ilibjttu.fsf@gnu.org> <83fsdfjsq9.fsf@gnu.org> <325aaa94-74fa-cf94-b66c-b87c69ebe386@gmx.at> <838rj6ic34.fsf@gnu.org> <83pmciggwn.fsf@gnu.org> <89b63947-5b2d-8bd1-4e9a-7da6cf114ffe@gmx.at> <83edsxhq9f.fsf@gnu.org> From: martin rudalics In-Reply-To: <83edsxhq9f.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:f6IJY5JAfVezQnfgOtQ1xfnDxXRGWpO3ugs6PrFbyGXZCK56drA sXuuxs8z2nq46RQctGP1JucUDZxc3e/n3DflFPfNGIoRoUnDaAYIeQJacwvJlBTqmhjWQbL 5cxE2sL+4m4KUuTldTVspaTXUnB9maOafye2khyVvW0mIpvptM0k1G8EyKbw2JXJMs3Q13r fbwT3Bzds5xDMmoYfmnvQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:jifIwql0Pok=;HWsnPdrV1D5o7HTLxQ82XUCddp4 jRFLRh73JauF1gqzrLd6wGKwWXTXlOMyrGgSJHOb7uoXIkrtyyawZcs/Jg/Qj+LkfHyTi5l1g cGboyQWXCc4RLAF+iXzUls+QfpAJCkzWXl9rnM7MVS0/a8wPqb3NdeCbOtEFDkXfFsX43mWgc wsjUv24zQSExBP1AGcUbMK6jom7txm0eQ8qIp/K5dQd0HY0SXR191tray/2AhBXZWpLQnIYeK 4tvNtaPS1ckHPh1bFO6/ie8XDjDbEaAfZMZF4e42hSpwIC0fXFOamzg/WdekRPlts6E4sZdql XUR3mk9Yus71XKy7yN+327JtYf39vHenqz+bmV9KztrwHo/4MXSnj7Thw9jG+HX7fCtrKUPaR LaJUrEzof0C7XiL3H/XVTqkf+s82eKnuqgEGqivXVstQREvoaebDrWFgVr9hhBb76MlynAPPl E8bm2ymwR1hclEg+Dmico/7bs4DY8tK9bEOKlzzDwpgQRoXVfSbXgNOY8AdvRYQ9oxOQ+XEri jVoe6CliKol2wZN8usxCwChiRu3L/PsAnLjKLNkSWnfaw4l0TuipNJn2u/X4ojd56fXUxPc2v d3YiI6KfLNDat+PZOCYrhR7Cp1KRKcLezjSKXDrf15TS6pr5E1UZwJi1rkYqTBAlOcppjgN1t X4Cw3ZLZJ4jUE2gs3CvGyd5MJMmaTG7JfGpQR3iWfIwnA1ewIRfNMswNXExIEnANEpba2COP6 rQjNVZhNlNpMzep7w7yOivfWElSbzwriGdy4aR1xEMKoEFl55GESe/TSVCllLE16vIfB53h4m ZYYjrvnixbxl3BXN8imbLI+ugk+0W3xOta2xy6zBRM99kcBFlMgHTJZL7IANA+UDDPOrm634r fDJ0Ua/BqDSr3J2Ovo8JkzzqQGGuWZKsZ54/90rYWb10wWxhQ4TrUIS3tliiC/EEzUKp6J3PL U2YXyA== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60096 Cc: 60096@debbugs.gnu.org, juri@linkov.net 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.7 (-) >> >> Alternatively, we could exclude windows with a nil buffer in >> >> add_window_to_list (think of the case that within the blurb >> >> producing code someone wants to consult the window list). >> > >> > Maybe we should try this on master. I indeed expected >> > add_window_to_list to filter such invalid windows and was surprised >> > that it didn't. Basically, I don't understand how we never had such >> > windows in the list before, since there's no code which actively >> > removes them and thus protects the list from holding such windows. I >> > think we just have been lucky. >> >> Probably so far we never tried to call 'kill-buffer' from within >> 'set-window-configuration'. If the only "live" window shows *scratch*, >> *scratch* gets killed and we kill a temporary buffer before we were able >> to recreate *scratch*, window_list will return the empty list. > > Why the empty list? The buffer gets killed, but windows don't get > killed. We still have the frame with at least two windows (including > the mini-window). Right? Not if we exclude windows with a nil buffer as suggested above. The delete_all_child_windows call in 'set-window-configuration' sets the contents field of every live window on that frame to nil and as long as we have not been able to get a live buffer for that window, it will stay nil. That's where all those windows with a nil buffer in your investigations come from. It's simply not safe to deal with windows before 'set-window-configuration' has done its work completely. If we think of running Lisp in this time, we have to do it in a completely restricted way: Any window, including the selected one, can legitimately have a nil buffer then. martin From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 18 06:40:46 2022 Received: (at 60096) by debbugs.gnu.org; 18 Dec 2022 11:40:46 +0000 Received: from localhost ([127.0.0.1]:33447 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6s29-0007uH-TH for submit@debbugs.gnu.org; Sun, 18 Dec 2022 06:40:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50650) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6s28-0007uB-VH for 60096@debbugs.gnu.org; Sun, 18 Dec 2022 06:40:45 -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 1p6s22-0007W8-2v; Sun, 18 Dec 2022 06:40:38 -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=snikGSpSPpDflM0P0GyVej/zjsQJrEFlmuwn/2fqHUY=; b=Kmm2MNnucxvI 15SbcmvJiQrp0lfBXi05mzlQTFmWm0YrVo7DpTgJ/bfOEEI/aPfujA8ZQuPP8xZKS9Aq0A8pTHv0R rhf3EzVTFWBoi+ZXMaQg1vCbVMCLut2wARRtUnonHFVD3nWV+25oCLXz4kzPIstyDuSYjo5fk0qKo +sLlKLeCaia+A1Wz4ZHpNF9eLti1xt6ZrPvlR6RN4lLyYR35xcTf1sBG3+QuH8xLj2IM7H+gP9nIQ TJYQQv0zKQF1S8oPr5+KCwkXcbbmdhUwb6Qu594R91ceNkP2BV1JccnurP4gTe3Runen/ZZG52JIV Jf+Nd+dIiedHUIsyb+fW1w==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6s20-0006kf-0h; Sun, 18 Dec 2022 06:40:37 -0500 Date: Sun, 18 Dec 2022 13:40:43 +0200 Message-Id: <83h6xtey84.fsf@gnu.org> From: Eli Zaretskii To: martin rudalics In-Reply-To: (message from martin rudalics on Sun, 18 Dec 2022 10:18:18 +0100) Subject: Re: bug#60096: 29.0.60; Crash in format_mode_line_unwind_data References: <86a63oen2m.fsf@mail.linkov.net> <83sfhgjqd7.fsf@gnu.org> <86cz8jls87.fsf@mail.linkov.net> <83k02rk1vk.fsf@gnu.org> <83ilibjttu.fsf@gnu.org> <83fsdfjsq9.fsf@gnu.org> <325aaa94-74fa-cf94-b66c-b87c69ebe386@gmx.at> <838rj6ic34.fsf@gnu.org> <83pmciggwn.fsf@gnu.org> <89b63947-5b2d-8bd1-4e9a-7da6cf114ffe@gmx.at> <83edsxhq9f.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60096 Cc: 60096@debbugs.gnu.org, juri@linkov.net 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 (---) > Date: Sun, 18 Dec 2022 10:18:18 +0100 > Cc: juri@linkov.net, 60096@debbugs.gnu.org > From: martin rudalics > > >> Probably so far we never tried to call 'kill-buffer' from within > >> 'set-window-configuration'. If the only "live" window shows *scratch*, > >> *scratch* gets killed and we kill a temporary buffer before we were able > >> to recreate *scratch*, window_list will return the empty list. > > > > Why the empty list? The buffer gets killed, but windows don't get > > killed. We still have the frame with at least two windows (including > > the mini-window). Right? > > Not if we exclude windows with a nil buffer as suggested above. The > delete_all_child_windows call in 'set-window-configuration' sets the > contents field of every live window on that frame to nil and as long as > we have not been able to get a live buffer for that window, it will stay > nil. Well, you forget *Messages*. But I get your point. > That's where all those windows with a nil buffer in your > investigations come from. It's simply not safe to deal with windows > before 'set-window-configuration' has done its work completely. If we > think of running Lisp in this time, we have to do it in a completely > restricted way: Any window, including the selected one, can legitimately > have a nil buffer then. With the current code, this is what happens: the window-related functions called from set-window-configuration either manage to get along with such windows, or are called via safe_call, which catches any errors. And AFAIU the code in set-window-configuration attempts to make sure that every window we reinstate from the saved window-configuration will have a valid buffer when we are done looping over all of the saved windows. From unknown Sun Aug 17 04:15:33 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 15 Jan 2023 12:24:10 +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