From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#60096: 29.0.60; Crash in format_mode_line_unwind_data Date: Sat, 17 Dec 2022 17:59:36 +0200 Message-ID: <83pmciggwn.fsf@gnu.org> 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> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27620"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60096@debbugs.gnu.org, juri@linkov.net To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 17 17:00:11 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p6Zbe-0006yg-Dg for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 17 Dec 2022 17:00:10 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p6ZbY-0007y5-7u; Sat, 17 Dec 2022 11:00:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6ZbW-0007xq-Fj for bug-gnu-emacs@gnu.org; Sat, 17 Dec 2022 11:00:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p6ZbW-0002on-5b for bug-gnu-emacs@gnu.org; Sat, 17 Dec 2022 11:00:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p6ZbW-0002Qh-0M for bug-gnu-emacs@gnu.org; Sat, 17 Dec 2022 11:00:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Dec 2022 16:00:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60096 X-GNU-PR-Package: emacs Original-Received: via spool by 60096-submit@debbugs.gnu.org id=B60096.16712927849309 (code B ref 60096); Sat, 17 Dec 2022 16:00:01 +0000 Original-Received: (at 60096) by debbugs.gnu.org; 17 Dec 2022 15:59:44 +0000 Original-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 Original-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 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 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==; Original-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 In-Reply-To: (message from martin rudalics on Sat, 17 Dec 2022 16:26:36 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:251287 Archived-At: > 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.