From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Nicolas Carranza Newsgroups: gmane.emacs.bugs Subject: bug#44111: 27.1; segmentation fault starting emacsclient with -n option Date: Wed, 21 Oct 2020 16:25:27 -0500 Message-ID: References: <83mu0fmw22.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000011368b05b234fdbe" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28460"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 44111@debbugs.gnu.org, nicarran@yandex.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 21 23:53:15 2020 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 1kVM2l-0007IP-6O for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 21 Oct 2020 23:53:15 +0200 Original-Received: from localhost ([::1]:45966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVM2k-0001Uf-9V for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 21 Oct 2020 17:53:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLvp-0005qs-AL for bug-gnu-emacs@gnu.org; Wed, 21 Oct 2020 17:46:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39218) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kVLvm-0004Rn-0K for bug-gnu-emacs@gnu.org; Wed, 21 Oct 2020 17:46:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kVLvl-00069r-UB for bug-gnu-emacs@gnu.org; Wed, 21 Oct 2020 17:46:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Nicolas Carranza Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 21 Oct 2020 21:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44111 X-GNU-PR-Package: emacs Original-Received: via spool by 44111-submit@debbugs.gnu.org id=B44111.160331672223617 (code B ref 44111); Wed, 21 Oct 2020 21:46:01 +0000 Original-Received: (at 44111) by debbugs.gnu.org; 21 Oct 2020 21:45:22 +0000 Original-Received: from localhost ([127.0.0.1]:50764 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVLv7-00068r-DO for submit@debbugs.gnu.org; Wed, 21 Oct 2020 17:45:21 -0400 Original-Received: from mail-ej1-f41.google.com ([209.85.218.41]:37028) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVLc7-0005by-JK for 44111@debbugs.gnu.org; Wed, 21 Oct 2020 17:25:44 -0400 Original-Received: by mail-ej1-f41.google.com with SMTP id e22so5329828ejr.4 for <44111@debbugs.gnu.org>; Wed, 21 Oct 2020 14:25:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PSwM+WNENwBAmse3cEXrqnde+uyYYwYwH/tQpwXQae0=; b=NapNd8ODsYWv5/HpfluMFrUDN332Nyagl0VJPvSggrpstHU3bxedsPQXhCUCf+n1Dn E0lSJs1/norv7l1B7WB+9sFs7jtF1NxI1E4QaQhbehgu/80FhVMTgTDbDKnyarvkJh8C 4crvPQFCGAlt5lZUKbkoN9SmoXzqUXkJpzitJbkEwZ1SyiZPaQfJk62fph7x9FtPANhV 2zu06lJi3ZVHpeZKAfaA7zCGmb5k5wFQsqdxYGzyjAOuQ3WltZ7KBhlxghh9FvQPzq8e E6jYgbxV+G1WooeAyy1KsxqjZmhYoCOo1hOzKngwKWEOe3EdrKuHSFp3IfMfsbPS2esd 9MCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PSwM+WNENwBAmse3cEXrqnde+uyYYwYwH/tQpwXQae0=; b=DpVQghyFdVX4bdI1QNtMSl6fB32RueFWwsPLXeiqEFmGaiLc8A6/5epo62vKhss3wJ rHZJmB4IBh4hZEd8OWtjgpdUa6iOZrsHZd/zcVLMTkzNaoJ0fLI3zbPXWzMAdf3IwgBr hpfleq9qr+ctELvHo7CB7fILBTFK9MYSFHOfk/J3+g6tUiWjjwWMhlYZLUys66cw/Htb GMANL1O51HVvbjlre7lEasFb0XnxKSsxzJR6p9vj0KD2tXzcLgCvhTB1/Vaw4QEcBQRe sS5ex7aLiOyTNF5N5yoCVZgQ5dF0F0UoymmHeHJBJS/y4q5L6W16fUwBcsAmJ+EC/74r 2xjA== X-Gm-Message-State: AOAM530jSg+UKQ+x5TFy70ALdQVblWHiXytVCiuiZ72ovI2e9zHdd+9G WesvluRk6d5UMMu2VrloyFTqsDYBUe+VIe1wak4= X-Google-Smtp-Source: ABdhPJyrMtOrGs0PgM8D9i52GO1k64lu/6DtogWGp7LqX4FXGdMEUmY/jPrh5BGRppP5UMmmxPFdHaqNyjLoVP/I0kw= X-Received: by 2002:a17:906:7d7:: with SMTP id m23mr5602503ejc.47.1603315537358; Wed, 21 Oct 2020 14:25:37 -0700 (PDT) In-Reply-To: <83mu0fmw22.fsf@gnu.org> X-Mailman-Approved-At: Wed, 21 Oct 2020 17:45:20 -0400 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" Xref: news.gmane.io gmane.emacs.bugs:191217 Archived-At: --00000000000011368b05b234fdbe Content-Type: text/plain; charset="UTF-8" I tested branch emacs-27 including your patch and the bug is gone, excellent, :-) I will continue using this version and report new problems if there are any. Thank you! On Wed, Oct 21, 2020 at 10:35 AM Eli Zaretskii wrote: > > From: Nicolas Carranza > > Date: Wed, 21 Oct 2020 00:07:49 -0500 > > Cc: nicarran@yandex.com > > > > I can reproduce an emacs segmentation fault following this steps on my > > system: > > > > 1. Start emacs as daemon using: > > emacs --daemon=myEmacs > > > > 2. Start emacsclient using: > > emacsclient -s myEmacs -n -c test.org > > > > 3. emacs crashes: > > Thanks. > > Can you try the patch below? I've just installed it on the emacs-27 > branch. > > diff --git a/src/xdisp.c b/src/xdisp.c > index 6c401d0..03dc4be 100644 > --- a/src/xdisp.c > +++ b/src/xdisp.c > @@ -22793,6 +22793,10 @@ maybe_produce_line_number (struct it *it) > int lnum_face_id = merge_faces (it->w, Qline_number, 0, > DEFAULT_FACE_ID); > int current_lnum_face_id > = merge_faces (it->w, Qline_number_current_line, 0, DEFAULT_FACE_ID); > + /* From here onwards, we must prevent freeing realized faces, because > + we are using the above 2 face IDs for the glyphs we produce. */ > + bool save_free_realized_faces = inhibit_free_realized_faces; > + inhibit_free_realized_faces = true; > /* Compute point's line number if needed. */ > if ((EQ (Vdisplay_line_numbers, Qrelative) > || EQ (Vdisplay_line_numbers, Qvisual) > @@ -22922,10 +22926,13 @@ maybe_produce_line_number (struct it *it) > it->lnum_width = 0; > it->lnum_pixel_width = 0; > bidi_unshelve_cache (itdata, false); > + inhibit_free_realized_faces = save_free_realized_faces; > return; > } > } > > + inhibit_free_realized_faces = save_free_realized_faces; > + > /* Record the width in pixels we need for the line number display. */ > it->lnum_pixel_width = tem_it.current_x; > /* Copy the produced glyphs into IT's glyph_row. */ > --00000000000011368b05b234fdbe Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I tested branch emacs-27 including your patch and the bu= g is gone, excellent, :-)
I will continue using this version = and report new problems if there are any.
Thank you!

On Wed, Oct 21, 2020 at 10:35 AM Eli Zaretskii <eliz@gnu.org> wrote:
> From: Nicolas Carranza <nicarran@gmail.com>
> Date: Wed, 21 Oct 2020 00:07:49 -0500
> Cc: nicarran@= yandex.com
>
> I can reproduce an emacs segmentation fault following this steps on my=
> system:
>
> 1. Start emacs as daemon using:
> emacs --daemon=3DmyEmacs
>
> 2. Start emacsclient using:
> emacsclient -s myEmacs -n -c test.org
>
> 3. emacs crashes:

Thanks.

Can you try the patch below?=C2=A0 I've just installed it on the emacs-= 27
branch.

diff --git a/src/xdisp.c b/src/xdisp.c
index 6c401d0..03dc4be 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -22793,6 +22793,10 @@ maybe_produce_line_number (struct it *it)
=C2=A0 =C2=A0int lnum_face_id =3D merge_faces (it->w, Qline_number, 0, D= EFAULT_FACE_ID);
=C2=A0 =C2=A0int current_lnum_face_id
=C2=A0 =C2=A0 =C2=A0=3D merge_faces (it->w, Qline_number_current_line, 0= , DEFAULT_FACE_ID);
+=C2=A0 /* From here onwards, we must prevent freeing realized faces, becau= se
+=C2=A0 =C2=A0 =C2=A0we are using the above 2 face IDs for the glyphs we pr= oduce.=C2=A0 */
+=C2=A0 bool save_free_realized_faces =3D inhibit_free_realized_faces;
+=C2=A0 inhibit_free_realized_faces =3D true;
=C2=A0 =C2=A0/* Compute point's line number if needed.=C2=A0 */
=C2=A0 =C2=A0if ((EQ (Vdisplay_line_numbers, Qrelative)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 || EQ (Vdisplay_line_numbers, Qvisual)
@@ -22922,10 +22926,13 @@ maybe_produce_line_number (struct it *it)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 it->lnum_width =3D 0;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 it->lnum_pixel_width =3D 0;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bidi_unshelve_cache (itdata, false);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0inhibit_free_realized_faces =3D save_fre= e_realized_faces;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0}

+=C2=A0 inhibit_free_realized_faces =3D save_free_realized_faces;
+
=C2=A0 =C2=A0/* Record the width in pixels we need for the line number disp= lay.=C2=A0 */
=C2=A0 =C2=A0it->lnum_pixel_width =3D tem_it.current_x;
=C2=A0 =C2=A0/* Copy the produced glyphs into IT's glyph_row.=C2=A0 */<= br>
--00000000000011368b05b234fdbe--