From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dima Kogan Newsgroups: gmane.emacs.bugs Subject: bug#72165: 31.0.50; Intermittent crashing with recent emacs build Date: Sun, 28 Jul 2024 19:50:52 -0700 Message-ID: <87msm0ud0z.fsf@secretsauce.net> References: <87o76veo04.fsf@secretsauce.net> <8634o7gusx.fsf@gnu.org> <874j8n6u1x.fsf@secretsauce.net> <86frs7f2n7.fsf@gnu.org> <87a5idj0yg.fsf@secretsauce.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2975"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 72165@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jul 29 04:51:15 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sYGTh-0000ZF-7y for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 29 Jul 2024 04:51:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sYGTN-0003ZI-Hz; Sun, 28 Jul 2024 22:50:53 -0400 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 1sYGTL-0003Yz-25 for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2024 22:50:51 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sYGTK-0002ay-Pb for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2024 22:50:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=qp88jwQXOQ/QJva+nHV0/V3NxxcR4gbztxWBrgRRluI=; b=VQFqXKr6f/r1I4rzZNl5Jb02Vx46FJ9OiGBoEIBu2k7nHfGOxur2Oant6Mh7AE6SDO0J5UCtEYdUrXWVqj12eh4k6Hy7YoeIQMH9cGkemZ/7Y6IWu2jSl7oS7Kv84CQRomHTZrn4PRMOey6J2ZxL7Ec6QhzZCZeP2b1NcLzVWkrf0tjdMQ618TyE1eKJNYtBrVEENHiQ3LHU/sOszpDwAPPskqxg1TBLtQ/F23rVm05o7KUlU/B4h5nhC63Z/D8mDEZa+TbLDVqaNArZPO2vV6NmBU4ff+MN/HJJ9dIQyLA5JeinrnpCceY/OqWF3DME1Kli3S64Rj4/BKAyC59LiA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sYGTW-0004Ci-K9 for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2024 22:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dima Kogan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 29 Jul 2024 02:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72165 X-GNU-PR-Package: emacs Original-Received: via spool by 72165-submit@debbugs.gnu.org id=B72165.172222144816137 (code B ref 72165); Mon, 29 Jul 2024 02:51:02 +0000 Original-Received: (at 72165) by debbugs.gnu.org; 29 Jul 2024 02:50:48 +0000 Original-Received: from localhost ([127.0.0.1]:44677 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sYGTI-0004CC-Bj for submit@debbugs.gnu.org; Sun, 28 Jul 2024 22:50:48 -0400 Original-Received: from fhigh8-smtp.messagingengine.com ([103.168.172.159]:40749) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sYGTF-0004Bx-AK for 72165@debbugs.gnu.org; Sun, 28 Jul 2024 22:50:47 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfhigh.nyi.internal (Postfix) with ESMTP id BBF641140121; Sun, 28 Jul 2024 22:50:27 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sun, 28 Jul 2024 22:50:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secretsauce.net; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1722221427; x= 1722307827; bh=qp88jwQXOQ/QJva+nHV0/V3NxxcR4gbztxWBrgRRluI=; b=X 3yciL3cYPdAVnpKpm6vrLfhN4leMIDciu4j/8GcEBQ8bS1yL5M/BOYU8x20Sg1n5 3abimUfjvrpfLwc7mRxV9qnP3xiUR5zjmVXUbJBPfPVSJi4TgW3wHeLIFRB57HJd VKrPQU6AXhuzBCkYAxRX2dqaNg2rFY3KiVmwVSmxH78ASDsSt+zMdRQ8+okvtJP2 xxumULrNBcSd+UAdkkZuPnofvbWcnZFdI/nknI1pNxi5fDDHdq7Hy4/z6TP/K4Mc G7W3Wcygr95ngIWX8IgKisv9JXf+l9iQitI4r9Qqnu8WkeniGpxfzsTzVO1norR4 RKlxPhJY+c1y4agVIUjgw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1722221427; x=1722307827; bh=qp88jwQXOQ/QJva+nHV0/V3NxxcR 4gbztxWBrgRRluI=; b=Y9LTMcmZPMzuKi3v7fKBxVeaN2kZ9c6Wv7QWNeJFKCBw BPDEQTQfoGsCWKHso4IlEOlgjm+mHpkmMkKM1zRRQxbcTTUF3T8RR4Gw2bUsvZkW NSI7lGxZB6a9ntwd86GOaS2F+uKBnxoXtXgKsTavKjzxi5uwJdJtAvWue+HrnxbC q1/rjgop8nijItOYor5kgEVp1TA2CdcAV1QjgF59yoMkc6jOmFyfdxBHQMZ2d7kp h8xcahomEcsKwrIhnjstuhYnJVA3ZaQBtuiqhPAHyzCqc3xg43c7mb50lRH/RpFq Nfc/0UMsQbTdFJuuFUcpF8MPqLKsrE15yPfzTu6tGg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrjedugdeigecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufgjfhffkfggtgesthdtredttddttdenucfhrhhomhepffhimhgrucfm ohhgrghnuceoughimhgrsehsvggtrhgvthhsrghutggvrdhnvghtqeenucggtffrrghtth gvrhhnpeekhfefjeegkeeiledtgffffeejieduleffieejgfelieeltdejueekhfefvdeg leenucffohhmrghinhepghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepughimhgrsehsvggtrhgvthhsrghutggvrdhn vghtpdhnsggprhgtphhtthhopedt X-ME-Proxy: Feedback-ID: i3e8042a0:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 28 Jul 2024 22:50:25 -0400 (EDT) In-Reply-To: <87a5idj0yg.fsf@secretsauce.net> (Dima Kogan's message of "Fri, 19 Jul 2024 00:27:35 -0700") 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:289504 Archived-At: Alright. After some flailing I was able to make it crash with rr, so now I can see EVERYTHING. rr is truly a miracle, and figuring this out without it would have been impossible. I walked around the rr trace, and I clearly see the crashing mechanism. I don't dare fix it myself, but hopefully one of you will be able to, without a lot of trouble. The buggy function is message_dolog(): https://github.com/dkogan/emacs-snapshot/blob/439ec471961/src/xdisp.c#L12041 On line 12075 we save the current point as a marker (i.e. both the byte and char positions): oldpoint = message_dolog_marker1; set_marker_restricted_both (oldpoint, Qnil, PT, PT_BYTE); In the failing sequence I had some non-ascii characters, so PT_BYTE would be ahead of PT (by either 4 or 8 bytes). This difference is recorded into oldpoint. Then on line 12177 we check if we're exceeding message-log-max, and if so, delete some stuff from the *Messages*. if (FIXNATP (Vmessage_log_max)) { scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -XFIXNAT (Vmessage_log_max) - 1, false); del_range_both (BEG, BEG_BYTE, PT, PT_BYTE, false); } In the failing sequence we delete some of the non-ascii characters. So the byte-char offset changes: it was 4 or 8 bytes, and it becomes 0 or 4 bytes. At this point we're still correct. But very shortly after this, on line 12205 we restore the oldpoint into the current point. Since we just deleted stuff from the BEGINNING of the buffer, the oldpoint doesn't point to the same thing as before. Restoring it directly is wrong, but this normally doesn't cause crashes. The thing that causes crashing is that sometimes the byte-char offset in oldpoint is no longer correct, and we fail the consistency checks in redisplay_window(). OK. If more investigating is needed, I still have the rr trace, and can pull it up again. But I think we're clear on what's happening, and hopefully no more digging is required. Thanks!