Subject: bug#65095: closed (Re: bug#65095: 30.0.50; thread_check_current_buffer)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 05 Aug 2023 15:33:02 +0000

Your bug report

#65095: 30.0.50; thread_check_current_buffer

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
65095: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65095
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#65095: 30.0.50; thread_check_current_buffer
From: Eli Zaretskii <[email-masked]>
To: Helmut Eller <[email-masked]>
Cc: [email-masked]
Date: Sat, 05 Aug 2023 18:32:34 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Helmut Eller <[email-masked]>
> Cc: [email-masked]
> Date: Sat, 05 Aug 2023 16:42:46 +0200
> 
> >> I don't understand why this check is there
> >
> > How would kill-buffer know whether it's okay to kill a buffer that is
> > current in another thread?  When we kill the current buffer in the
> > current thread, we do quite a bit of juggling to replace it with some
> > other, and punt if not possible.  We also "do nothing" if the buffer
> > to be killed is the currently active minibuffer or the sole visible
> > buffer.  So this "do nothing" in this case is not without precedent,
> > and cannot be just removed without having some non-trivial code in its
> > stead, right?
> 
> Well, then I guess this is just something that one has to accept when
> using threads.  One more reason not to use threads.
> 
> You can close the bug.

Done, thanks.

Subject: 30.0.50; thread_check_current_buffer
From: Helmut Eller <[email-masked]>
To: [email-masked]
Date: Sat, 05 Aug 2023 14:51:26 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

This test fails

(ert-deftest tmp-buf ()
  (let (buf)
    (with-temp-buffer
      (setq buf (current-buffer))
      (make-thread (lambda ())))
    (should-not (buffer-live-p buf))))

when executed with

  emacs -Q --batch -l tmp-buf.el -f ert-run-tests-batch-and-exit

The reason seems to be, that thread_check_current_buffer returns true
and hence kill_buffer simply returns without doing anything.

I don't understand why this check is there, but it's quite annoying in
practice.  E.g. ert--run-test-internal uses with-temp-buffer too, so if
make-thread is used in a test, the temporary buffers will hang around
and pile up.

In GNU Emacs 30.0.50 (build 26, x86_64-pc-linux-gnu, GTK+ Version
 3.24.37, cairo version 1.16.0) of 2023-08-04 built on caladan
Repository revision: 4de3198c10c4efaeaffdf43ba5e5b0f1729a7f09
Repository branch: interruptible-condition-wait
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --enable-checking=yes --with-xpm=ifavailable
 --with-gif=ifavailable 'CFLAGS=-g -O1''

Configured features:
CAIRO DBUS FREETYPE GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LIBSELINUX
LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND
SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2 GTK3
ZLIB

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