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