* bug#69529: 29.2; Segfault killing base buffer when the indirect buffer rejects kill-buffer
@ 2024-03-03 17:37 brubar.cs
2024-03-03 19:11 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: brubar.cs @ 2024-03-03 17:37 UTC (permalink / raw)
To: 69529
[-- Attachment #1: Type: text/plain, Size: 247 bytes --]
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
[-- Attachment #2: kill-buffer-segfault.el --]
[-- Type: text/plain, Size: 887 bytes --]
(defun my-reject-kill-buffer ()
(message "Do not kill %s" (current-buffer))
nil)
(defun my-trigger-bug ()
(let* ((base-buffer (generate-new-buffer "base"))
(indirect-buffer (make-indirect-buffer base-buffer
(generate-new-buffer-name "indirect"))))
;; base-buffer: no restriction on killing that buffer.
(with-current-buffer base-buffer
(insert "base buffer content")
(setq-local kill-buffer-query-functions nil))
;; indirect-buffer: reject any kill-buffer requests
(with-current-buffer indirect-buffer
(insert "indirect buffer content")
(setq-local kill-buffer-query-functions
(list 'my-reject-kill-buffer)))
;; Killing base-buffer
(with-current-buffer base-buffer
(kill-buffer))
;; This raises the segfault (emacs 29, emacs 30.0.50).
(switch-to-buffer indirect-buffer)))
(my-trigger-bug)
[-- Attachment #3: Type: text/plain, Size: 4256 bytes --]
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))
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#69529: 29.2; Segfault killing base buffer when the indirect buffer rejects kill-buffer
2024-03-03 17:37 bug#69529: 29.2; Segfault killing base buffer when the indirect buffer rejects kill-buffer brubar.cs
@ 2024-03-03 19:11 ` Eli Zaretskii
2024-03-03 20:46 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-04 8:04 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 2 replies; 5+ messages in thread
From: Eli Zaretskii @ 2024-03-03 19:11 UTC (permalink / raw)
To: brubar.cs, Stefan Monnier, martin rudalics; +Cc: 69529
> From: brubar.cs@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))
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#69529: 29.2; Segfault killing base buffer when the indirect buffer rejects kill-buffer
2024-03-03 19:11 ` Eli Zaretskii
@ 2024-03-03 20:46 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-04 8:04 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-03 20:46 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: brubar.cs, martin rudalics, 69529
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#69529: 29.2; Segfault killing base buffer when the indirect buffer rejects kill-buffer
2024-03-03 19:11 ` Eli Zaretskii
2024-03-03 20:46 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-04 8:04 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-04 13:01 ` Eli Zaretskii
1 sibling, 1 reply; 5+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-04 8:04 UTC (permalink / raw)
To: Eli Zaretskii, brubar.cs, Stefan Monnier; +Cc: 69529
> Stefan and Martin, is the below the right way of avoiding this?
I see no better way.
martin
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#69529: 29.2; Segfault killing base buffer when the indirect buffer rejects kill-buffer
2024-03-04 8:04 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-04 13:01 ` Eli Zaretskii
0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2024-03-04 13:01 UTC (permalink / raw)
To: martin rudalics; +Cc: brubar.cs, 69529-done, monnier
> Date: Mon, 4 Mar 2024 09:04:30 +0100
> Cc: 69529@debbugs.gnu.org
> From: martin rudalics <rudalics@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.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-03-04 13:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-03 17:37 bug#69529: 29.2; Segfault killing base buffer when the indirect buffer rejects kill-buffer brubar.cs
2024-03-03 19:11 ` Eli Zaretskii
2024-03-03 20:46 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-04 8:04 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-04 13:01 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.