From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#72692: Emacs 31.05 (40eecd594ac) get SIGSEGV on Linux (Linux 6.6.45 Kde Wayland) Date: Sun, 18 Aug 2024 13:44:41 +0000 Message-ID: <8734n2gd2x.fsf@protonmail.com> References: <8b1c8e1f-e0b9-4049-888c-3f723e0008a9@gmail.com> <87sev2gqc7.fsf@protonmail.com> <51a90b68-3958-4d6e-bfb1-1ea5a0e8ab11@gmail.com> <87le0ugp6i.fsf@protonmail.com> <6d4a3b17-a177-4b3b-8873-50662f56e304@gmail.com> <87h6bigoo5.fsf@protonmail.com> <7be3359e-4389-4bc6-bf98-b46a2a8a711c@gmail.com> <877ccegfxj.fsf@protonmail.com> <86h6biymv4.fsf@gnu.org> Reply-To: Pip Cet Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17555"; mail-complaints-to="usenet@ciao.gmane.io" Cc: execvy@gmail.com, 72692@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 18 15:45:42 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 1sfgE1-0004Oj-Jk for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Aug 2024 15:45:41 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sfgDm-0006K3-3U; Sun, 18 Aug 2024 09:45:26 -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 1sfgDh-0006JQ-Mj for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2024 09:45:23 -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 1sfgDh-0000x5-Cq for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2024 09:45:21 -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:References:In-Reply-To:From:Date:To:Subject; bh=iiCcnkQTo2IcFALG9OBtt9HwV17vnhSE6Q4wXXw5mqo=; b=Sq3ST/IzmZjH7+D9Fiq+7A2DgjxklNhCpr3MjRi8CGQAcyWe+zPouZ5mBd3n8MXB+0qnpi9tD7FFon7gd+zPpUtyckxSZtQnr7Y71Sqm555Lx9A+v+jNRVb6YB4XehgvUVhOMWOcE0aORpO+Eaz7LBkoX7y0IO4sF5DOEIDrJ6208Rj41/SFnFGh+9BK9PttViQLyVwhWrgSbwJjL0ZhqrOzvSWA5wwYZI4XELWWVpp6PwOBwcDngY0YYoM65GzAxtAInfMadRkXhzZ2AFpMvbwn86O6G+zfBoQhf1jcKX0z6Q5YqPrAEjNNG3kJU8LWAYb/6/JgMnLtr7iVDAVGoQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sfgEL-0006nT-K7 for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2024 09:46:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Aug 2024 13:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72692 X-GNU-PR-Package: emacs Original-Received: via spool by 72692-submit@debbugs.gnu.org id=B72692.172398873426087 (code B ref 72692); Sun, 18 Aug 2024 13:46:01 +0000 Original-Received: (at 72692) by debbugs.gnu.org; 18 Aug 2024 13:45:34 +0000 Original-Received: from localhost ([127.0.0.1]:55614 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfgDu-0006mg-Cu for submit@debbugs.gnu.org; Sun, 18 Aug 2024 09:45:34 -0400 Original-Received: from mail-40133.protonmail.ch ([185.70.40.133]:50085) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfgDs-0006mO-3L for 72692@debbugs.gnu.org; Sun, 18 Aug 2024 09:45:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1723988685; x=1724247885; bh=iiCcnkQTo2IcFALG9OBtt9HwV17vnhSE6Q4wXXw5mqo=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=fFXJNiUUAvd45uBfUMHyiNGRix77zkLda/iYn2UftjbBF3/cTg6uvkLAggt3VqZ5x UoWyKqiR8h7/7YmoQsmW3eWYxW07BUtvYixiKPdg/HiwOZgfTU1kb6Q3JvWnwZIvYs kNeHzV3bdICPNVUSfDlTZiYgijJ7vjAgozATZ9r83yN4vQ+AntHt+gSZNNeSzzCLzm w1JpQolVdffvpRGD5IGWy6CpUCIXxETs7w3eKLe8fHxK9ihnEcDp/ABi0KEaa31lwV icyzEkQi0sCdeE/C1d3ruxs6/CPya1iqmS1Y7QlXAW8YtsRty0/ZLXA4DCZlbtSY8w XfmMWDYzSPiog== In-Reply-To: <86h6biymv4.fsf@gnu.org> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: b7970fa110a1f72d5876f9382ce4eae988fe4b7e 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:290322 Archived-At: "Eli Zaretskii" writes: >> Cc: 72692@debbugs.gnu.org >> Date: Sun, 18 Aug 2024 12:43:06 +0000 >> From: Pip Cet via "Bug reports for GNU Emacs, >> the Swiss army knife of text editors" >> >> Thanks. That has a different fontset, so it looks like a fontset was >> prematurely freed while still being referred to by a face. I think the >> assumption made in xfaces.c, that it's always safe to free a fontset if >> we're freeing the realized ASCII face, is incorrect. > > Why do you think that? free_realized_face frees a face, so what other > face can still use the same fontset, if it's a so-called "ASCII face"? I was under the impression two faces could share the same fontset. That certainly is what my debugging sessions so far indicate. Maybe that's the bug? >> I can confirm that we're sometimes leaving a frame's fontset field >> invalid by running this code: > > If face2->ascii_face is equal to face->ascii_face, Yes, face2->ascii_face =3D=3D face =3D=3D face->ascii_face. > then I see no > reason not to free the fontset because of that other face. The > comment in dispextern.h says: > > /* Fontset ID if for this face's fontset. Non-ASCII faces derived > from the same ASCII face have the same fontset. */ > int fontset; So, indeed, the fontset id is shared between the ASCII face and the non-ASCII face. If we free the fontset because the ASCII face is unrealized, but the non-ASCII face is not, we hit the bug... > And how did you see that a frame's fontset was left invalid here? A > frame doesn't have a fontset, AFAIK. I meant "face", sorry! The non-ASCII face remains in the font cache, and its fontset is set to the newly freed fontset's ID, which is likely soon to be reused; only if it isn't, we see a crash. > I don't object to using this code as a means of investigation, of > course, but I think we should have a clear idea of what the diagnostic > it emits means. > > I also think it might be unsafe to call 'message' from this place, > because 'message' might trigger redisplay. It is better to call > message_dolog or add_to_log (and ask the user to look at *Messages*). It is, thank you! Yes, fprintf or message_dolog would have been better. Pip