Subject: bug#60626: 30.0.50; `buffer-live-p' sometimes returns t on killed buffers

From: Ihor Radchenko <[email-masked]>
Date: Sat, 07 Jan 2023 15:01:34 +0000

Eli Zaretskii <[email-masked]> writes:

>> We are recently experiencing test failures using Emacs 28, Emacs 27, and
>> Emacs 26 on CI (non-interactively):
>
> What about Emacs 29?  Or is this report only about versions 28 and
> older?  In the latter case, why would it suddenly start failing, if
> those versions are no longer being developed?

The failures are after we added `buffer-live-p' into assert form:
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?h=bugfix&id=41ebc2e40c33080a47cebb2507f038058b862655

Unfortunately, we don't have CI configuration for Emacs 29 now.

>> https://builds.sr.ht/~bzg/job/918602
>> 
>> 2 unexpected results:
>>    FAILED  ob-octave/graphics-file  ((should-not (buffer-live-p (get-buffer "*Org-Babel Error Output*"))) :form (buffer-live-p #<killed buffer>) :value t)
>>    FAILED  ob-octave/graphics-file-space  ((should-not (buffer-live-p (get-buffer "*Org-Babel Error Output*"))) :form (buffer-live-p #<killed buffer>) :value t)
>> 
>> Note that (buffer-live-p #<killed buffer>) returns non-nil, which is
>> unexpected.
>
> Are you sure this is the right interpretation?

I think so. The full backtrace is

Test ob-octave/graphics-file backtrace:
  signal(ert-test-failed (((should-not (buffer-live-p (get-buffer "*Or
  ert-fail(((should-not (buffer-live-p (get-buffer "*Org-Babel Error O
  (if (not (unwind-protect (setq value-1507 (apply fn-1505 args-1506))
  (let (form-description-1509) (if (not (unwind-protect (setq value-15
  (let ((value-1507 'ert-form-evaluation-aborted-1508)) (let (form-des
  (let* ((fn-1505 #'buffer-live-p) (args-1506 (condition-case err (let
  (progn (org-mode) (let ((point (string-match "<point>" inside-text))
  (unwind-protect (progn (org-mode) (let ((point (string-match "<point
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn
  (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current
  (let ((inside-text (if (stringp (format "#+begin_src octave :results
  (unwind-protect (let ((inside-text (if (stringp (format "#+begin_src
  (let ((file (make-temp-file "test-ob-octave-" nil ".png"))) (unwind-
  (let ((lexical-binding t)) (if (get-buffer "*Org-Babel Error Output*
  (closure (t) nil (let ((lexical-binding t)) (if (get-buffer "*Org-Ba
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name ob-octave/graphics-file :documentatio
  ert-run-or-rerun-test(#s(ert--stats :selector "\\(org\\|ob\\|ox\\...
  ert-run-tests("\\(org\\|ob\\|ox\\)" #f(compiled-function (event-type
  ert-run-tests-batch("\\(org\\|ob\\|ox\\)")
  ert-run-tests-batch-and-exit("\\(org\\|ob\\|ox\\)")
  (let ((org-id-track-globally t) (org-test-selector (if org-test-sele
  org-test-run-batch-tests("\\(org\\|ob\\|ox\\)")
  command-line-1(("--load" "/home/build/.emacs.d/init.el" "--eval" "(s
  command-line()
  normal-top-level()
Test ob-octave/graphics-file condition:
    (ert-test-failed
     ((should-not
       (buffer-live-p
	(get-buffer "*Org-Babel Error Output*")))
      :form
      (buffer-live-p #<killed buffer>)
      :value t))
   FAILED   164/1187  ob-octave/graphics-file (0.257630 sec)

> Anyway, is there any hope for a more self-contained recipe, which I
> could try on my system without too much ado?

Unfortunately, no. Tests are not failing for me locally, so the
container setup appears to be part of the recipe.

I was only able to reproduce locally running the container.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>