GNU bug report logs - #69529
29.2; Segfault killing base buffer when the indirect buffer rejects kill-buffer

Previous Next

Package: emacs;

Reported by: brubar.cs <at> gmail.com

Date: Sun, 3 Mar 2024 17:39:01 UTC

Severity: normal

Found in version 29.2

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 69529 in the body.
You can then email your comments to 69529 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#69529; Package emacs. (Sun, 03 Mar 2024 17:39:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to brubar.cs <at> gmail.com:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 03 Mar 2024 17:39:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: brubar.cs <at> gmail.com
To: bug-gnu-emacs <at> gnu.org
Subject: 29.2; Segfault killing base buffer when the indirect buffer rejects
 kill-buffer
Date: Sun, 03 Mar 2024 18:37:53 +0100
[Message part 1 (text/plain, inline)]
Emacs segfaults when evaluating the attached elisp file like this:

   emacs -Q -l kill-buffer-segfault.el

It happens to me, both with GNU Emacs 30.0.50 and 29.2.

Let me know if you need me to collect more information locally.

Thanks,

Bruno

[kill-buffer-segfault.el (text/plain, attachment)]
[Message part 3 (text/plain, inline)]

In GNU Emacs 29.2 (build 1, x86_64-pc-linux-gnu, cairo version 1.18.0)
 of 2024-03-02 built on localhost
Windowing system distributor 'The X.Org Foundation', version 11.0.12101011
System Description: Gentoo Linux

Configured using:
 'configure --prefix=/usr --build=x86_64-pc-linux-gnu
 --host=x86_64-pc-linux-gnu --mandir=/usr/share/man
 --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc
 --localstatedir=/var/lib --datarootdir=/usr/share
 --disable-silent-rules --docdir=/usr/share/doc/emacs-29.2-r1
 --htmldir=/usr/share/doc/emacs-29.2-r1/html --libdir=/usr/lib64
 --program-suffix=-emacs-29 --includedir=/usr/include/emacs-29
 --infodir=/usr/share/info/emacs-29 --localstatedir=/var
 --enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp
 --without-compress-install --without-hesiod --without-pop
 --with-file-notification=inotify --with-pdumper --enable-acl
 --with-dbus --without-modules --without-gameuser --with-libgmp
 --with-gpm --with-native-compilation=aot --without-json
 --without-kerberos --without-kerberos5 --with-lcms2 --with-xml2
 --without-mailutils --without-selinux --without-sqlite3 --with-gnutls
 --without-libsystemd --with-threads --without-tree-sitter
 --without-wide-int --with-sound=no --with-zlib --with-x --without-pgtk
 --without-ns --without-gconf --without-gsettings
 --without-toolkit-scroll-bars --with-xpm --with-xft --with-cairo
 --without-harfbuzz --without-libotf --without-m17n-flt
 --with-x-toolkit=no --without-gif --with-jpeg --with-png --with-rsvg
 --with-tiff --without-webp --with-imagemagick --with-dumping=pdumper
 'CFLAGS=-march=native -O2 -pipe' 'LDFLAGS=-Wl,-O1 -Wl,--as-needed''

Configured features:
ACL CAIRO DBUS FREETYPE GLIB GMP GNUTLS GPM IMAGEMAGICK JPEG LCMS2
LIBXML2 NATIVE_COMP NOTIFY INOTIFY OLDXMENU PDUMPER PNG RSVG SECCOMP
THREADS TIFF X11 XDBE XIM XINPUT2 XPM ZLIB

Important settings:
  value of $LC_CTYPE: en_US.UTF-8
  value of $LANG: C.UTF8
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils comp comp-cstr
subr-x rx cl-seq cl-macs gv cl-extra help-mode bytecomp byte-compile
warnings icons cl-loaddefs cl-lib site-gentoo rmc iso-transl tooltip
cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting font-render-setting cairo xinput2 x multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 78936 6614)
 (symbols 48 7120 0)
 (strings 32 19234 2559)
 (string-bytes 1 580076)
 (vectors 16 15692)
 (vector-slots 8 321239 17561)
 (floats 8 34 120)
 (intervals 56 443 2)
 (buffers 976 12))

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69529; Package emacs. (Sun, 03 Mar 2024 19:13:02 GMT) Full text and rfc822 format available.

Message #8 received at 69529 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: brubar.cs <at> gmail.com, Stefan Monnier <monnier <at> iro.umontreal.ca>,
 martin rudalics <rudalics <at> gmx.at>
Cc: 69529 <at> debbugs.gnu.org
Subject: Re: bug#69529: 29.2;
 Segfault killing base buffer when the indirect buffer rejects
 kill-buffer
Date: Sun, 03 Mar 2024 21:11:43 +0200
> From: brubar.cs <at> gmail.com
> Date: Sun, 03 Mar 2024 18:37:53 +0100
> 
> Emacs segfaults when evaluating the attached elisp file like this:
> 
>    emacs -Q -l kill-buffer-segfault.el
> 
> It happens to me, both with GNU Emacs 30.0.50 and 29.2.

Stefan and Martin, is the below the right way of avoiding this?

diff --git a/src/buffer.c b/src/buffer.c
index 126f3eb..bccf65f 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1971,8 +1971,14 @@ DEFUN ("kill-buffer", Fkill_buffer, Skill_buffer, 0, 1, "bKill buffer: ",
       Lisp_Object tail, other;
 
       FOR_EACH_LIVE_BUFFER (tail, other)
-	if (XBUFFER (other)->base_buffer == b)
-	  Fkill_buffer (other);
+	{
+	  if (XBUFFER (other)->base_buffer == b)
+	    {
+	      Fkill_buffer (other);
+	      if (BUFFER_LIVE_P (XBUFFER (other)))
+		error ("Attempt to kill buffer whose indirect buffer cannot be killed");
+	    }
+	}
 
       /* Exit if we now have killed the base buffer (Bug#11665).  */
       if (!BUFFER_LIVE_P (b))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69529; Package emacs. (Sun, 03 Mar 2024 20:48:01 GMT) Full text and rfc822 format available.

Message #11 received at 69529 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: brubar.cs <at> gmail.com, martin rudalics <rudalics <at> gmx.at>,
 69529 <at> debbugs.gnu.org
Subject: Re: bug#69529: 29.2; Segfault killing base buffer when the indirect
 buffer rejects kill-buffer
Date: Sun, 03 Mar 2024 15:46:31 -0500
> Stefan and Martin, is the below the right way of avoiding this?

I don't know if it's The Right Way (I mean: who the hell does this
indirect buffer think he is, to resist killing?), but it looks fine
to me.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69529; Package emacs. (Mon, 04 Mar 2024 08:06:01 GMT) Full text and rfc822 format available.

Message #14 received at 69529 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>, brubar.cs <at> gmail.com,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 69529 <at> debbugs.gnu.org
Subject: Re: bug#69529: 29.2; Segfault killing base buffer when the indirect
 buffer rejects kill-buffer
Date: Mon, 4 Mar 2024 09:04:30 +0100
> Stefan and Martin, is the below the right way of avoiding this?

I see no better way.

martin






Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Mon, 04 Mar 2024 13:02:01 GMT) Full text and rfc822 format available.

Notification sent to brubar.cs <at> gmail.com:
bug acknowledged by developer. (Mon, 04 Mar 2024 13:02:02 GMT) Full text and rfc822 format available.

Message #19 received at 69529-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: brubar.cs <at> gmail.com, 69529-done <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#69529: 29.2; Segfault killing base buffer when the indirect
 buffer rejects kill-buffer
Date: Mon, 04 Mar 2024 15:01:03 +0200
> Date: Mon, 4 Mar 2024 09:04:30 +0100
> Cc: 69529 <at> debbugs.gnu.org
> From: martin rudalics <rudalics <at> gmx.at>
> 
> > Stefan and Martin, is the below the right way of avoiding this?
> 
> I see no better way.

Thanks, Stefan and Martin.  I installed the change on the master
branch, and I'm therefore closing this bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 02 Apr 2024 11:24:15 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 120 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.