Subject: bug#69809: 30.0.50; flymake: error in process sentinel

From: Eshel Yaron <[email-masked]>
Date: Wed, 17 Jul 2024 15:08:51 +0200

Hi João,

João Távora <[email-masked]> writes:

> On Wed, Jul 17, 2024 at 9:20 AM João Távora <[email-masked]> wrote:
>>
>> On Wed, Jul 17, 2024 at 7:12 AM Eshel Yaron <[email-masked]> wrote:
>>
>> > > Yes, this seems good for emacs-30.  Thanks Eshel!
>> > Great, thanks.  Since this is a change in eglot.el, let me also ask João
>> > before installing: João, any objections to the change above?
>>
>> I'd like to understand what problem it is solving.
>
> I've read a bit of the thread.  There seems to be an error involved,
> but I didn't see a backtrace for this error.  Can someone produce it?

Sure, here's one (also see the recipe I posted upthread):

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (error "Can’t find state for flymake-cc in ‘flymake--state’")
  signal(error ("Can’t find state for flymake-cc in ‘flymake--state’"))
  error("Can't find state for %s in `flymake--state'" flymake-cc)
  (or (gethash backend flymake--state) (error "Can't find state for %s in `flymake--state'" backend))
  (let ((state (or (gethash backend flymake--state) (error "Can't find state for %s in `flymake--state'" backend))) expected-token) (cond ((null state) (flymake-error "Unexpected report from unknown backend %s" backend)) ((let* ((cl-x state)) (progn (or (let* ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-flymake--state-tags) t))) (signal 'wrong-type-argument (list 'flymake--state cl-x))) (aref cl-x 3))) (flymake-error "Unexpected report from disabled backend %s" backend)) ((progn (setq expected-token (let* ((cl-x state)) (progn (or (let* ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-flymake--state-tags) t))) (signal 'wrong-type-argument (list 'flymake--state cl-x))) (aref cl-x 1)))) (null expected-token)) (flymake-error "Unexpected report from stopped backend %s" backend)) ((not (or (eq expected-token token) force)) (flymake-error "Obsolete report from backend %s with explanation %s" backend explanation)) ((eq :panic report-action) (flymake--disable-backend backend explanation)) ((not (listp report-action)) (flymake--disable-backend backend (format "Unknown action %S" report-action)) (flymake-error "Expected report, but got unknown key %s" report-action)) (t (flymake--publish-diagnostics report-action :backend backend :state state :region region) (if flymake-check-start-time (progn (flymake--log-1 :debug 'flymake "backend %s reported %d diagnostics in %.2f second(s)" backend (length report-action) (float-time (time-since flymake-check-start-time))))))) (let* ((cl-x state)) (or (let* ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-flymake--state-tags) t))) (signal 'wrong-type-argument (list 'flymake--state cl-x))) (let* ((v cl-x)) (aset v 2 t))) (if (and flymake-show-diagnostics-at-end-of-line (not (cl-set-difference (flymake-running-backends) (flymake-reporting-backends)))) (progn (flymake--update-eol-overlays))) (flymake--update-diagnostics-listings (current-buffer)))
  (let* ((explanation (car (cdr (plist-member --cl-rest-- ':explanation)))) (force (car (cdr (plist-member --cl-rest-- ':force)))) (region (car (cdr (plist-member --cl-rest-- ':region))))) (let ((state (or (gethash backend flymake--state) (error "Can't find state for %s in `flymake--state'" backend))) expected-token) (cond ((null state) (flymake-error "Unexpected report from unknown backend %s" backend)) ((let* ((cl-x state)) (progn (or (let* ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-flymake--state-tags) t))) (signal 'wrong-type-argument (list 'flymake--state cl-x))) (aref cl-x 3))) (flymake-error "Unexpected report from disabled backend %s" backend)) ((progn (setq expected-token (let* ((cl-x state)) (progn (or (let* ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-flymake--state-tags) t))) (signal 'wrong-type-argument (list 'flymake--state cl-x))) (aref cl-x 1)))) (null expected-token)) (flymake-error "Unexpected report from stopped backend %s" backend)) ((not (or (eq expected-token token) force)) (flymake-error "Obsolete report from backend %s with explanation %s" backend explanation)) ((eq :panic report-action) (flymake--disable-backend backend explanation)) ((not (listp report-action)) (flymake--disable-backend backend (format "Unknown action %S" report-action)) (flymake-error "Expected report, but got unknown key %s" report-action)) (t (flymake--publish-diagnostics report-action :backend backend :state state :region region) (if flymake-check-start-time (progn (flymake--log-1 :debug 'flymake "backend %s reported %d diagnostics in %.2f second(s)" backend (length report-action) (float-time (time-since flymake-check-start-time))))))) (let* ((cl-x state)) (or (let* ((cl-x cl-x)) (progn (and (memq (type-of cl-x) cl-struct-flymake--state-tags) t))) (signal 'wrong-type-argument (list 'flymake--state cl-x))) (let* ((v cl-x)) (aset v 2 t))) (if (and flymake-show-diagnostics-at-end-of-line (not (cl-set-difference (flymake-running-backends) (flymake-reporting-backends)))) (progn (flymake--update-eol-overlays))) (flymake--update-diagnostics-listings (current-buffer))))
  flymake--handle-report(flymake-cc backend-token6 nil)
  apply(flymake--handle-report flymake-cc backend-token6 nil)
  (save-current-buffer (set-buffer buffer) (apply #'flymake--handle-report backend token args))
  (progn (save-current-buffer (set-buffer buffer) (apply #'flymake--handle-report backend token args)))
  (if (buffer-live-p buffer) (progn (save-current-buffer (set-buffer buffer) (apply #'flymake--handle-report backend token args))))
  #f(lambda (&rest args) [(buffer #<buffer search.c>) (token backend-token6) (backend flymake-cc)] (if (buffer-live-p buffer) (progn (save-current-buffer (set-buffer buffer) (apply #'flymake--handle-report backend token args)))))(nil)
  funcall(#f(lambda (&rest args) [(buffer #<buffer search.c>) (token backend-token6) (backend flymake-cc)] (if (buffer-live-p buffer) (progn (save-current-buffer (set-buffer buffer) (apply #'flymake--handle-report backend token args))))) nil)
  (if (or diags (= 0 (process-exit-status p))) (funcall report-fn diags) (funcall report-fn :panic :explanation (buffer-substring (point-min) (progn (goto-char (point-min)) (line-end-position)))))
  (let ((diags (flymake-cc--make-diagnostics source))) (if (or diags (= 0 (process-exit-status p))) (funcall report-fn diags) (funcall report-fn :panic :explanation (buffer-substring (point-min) (progn (goto-char (point-min)) (line-end-position))))))
  (save-current-buffer (set-buffer (process-buffer p)) (goto-char (point-min)) (let ((diags (flymake-cc--make-diagnostics source))) (if (or diags (= 0 (process-exit-status p))) (funcall report-fn diags) (funcall report-fn :panic :explanation (buffer-substring (point-min) (progn (goto-char (point-min)) (line-end-position)))))))
  (progn (save-current-buffer (set-buffer (process-buffer p)) (goto-char (point-min)) (let ((diags (flymake-cc--make-diagnostics source))) (if (or diags (= 0 (process-exit-status p))) (funcall report-fn diags) (funcall report-fn :panic :explanation (buffer-substring (point-min) (progn (goto-char (point-min)) (line-end-position))))))))
  (if (save-current-buffer (set-buffer source) (eq p flymake-cc--proc)) (progn (save-current-buffer (set-buffer (process-buffer p)) (goto-char (point-min)) (let ((diags (flymake-cc--make-diagnostics source))) (if (or diags (= 0 (process-exit-status p))) (funcall report-fn diags) (funcall report-fn :panic :explanation (buffer-substring (point-min) (progn (goto-char (point-min)) (line-end-position)))))))))
  (progn (if (save-current-buffer (set-buffer source) (eq p flymake-cc--proc)) (progn (save-current-buffer (set-buffer (process-buffer p)) (goto-char (point-min)) (let ((diags (flymake-cc--make-diagnostics source))) (if (or diags (= 0 (process-exit-status p))) (funcall report-fn diags) (funcall report-fn :panic :explanation (buffer-substring (point-min) (progn (goto-char (point-min)) (line-end-position))))))))))
  (if (eq 'exit (process-status p)) (progn (if (save-current-buffer (set-buffer source) (eq p flymake-cc--proc)) (progn (save-current-buffer (set-buffer (process-buffer p)) (goto-char (point-min)) (let ((diags (flymake-cc--make-diagnostics source))) (if (or diags (= 0 (process-exit-status p))) (funcall report-fn diags) (funcall report-fn :panic :explanation (buffer-substring (point-min) (progn (goto-char (point-min)) (line-end-position)))))))))))
  (unwind-protect (if (eq 'exit (process-status p)) (progn (if (save-current-buffer (set-buffer source) (eq p flymake-cc--proc)) (progn (save-current-buffer (set-buffer (process-buffer p)) (goto-char (point-min)) (let ((diags (flymake-cc--make-diagnostics source))) (if (or diags (= 0 (process-exit-status p))) (funcall report-fn diags) (funcall report-fn :panic :explanation (buffer-substring (point-min) (progn (goto-char (point-min)) (line-end-position))))))))))) (if (process-live-p p) nil (kill-buffer (process-buffer p))))
  #f(lambda (p _ev) [(source #<buffer search.c>) (report-fn #f(lambda (&rest args) [(buffer #<buffer search.c>) (token backend-token6) (backend flymake-cc)] (if (buffer-live-p buffer) (progn (save-current-buffer (set-buffer buffer) (apply #'flymake--handle-report backend token args))))))] (unwind-protect (if (eq 'exit (process-status p)) (progn (if (save-current-buffer (set-buffer source) (eq p flymake-cc--proc)) (progn (save-current-buffer (set-buffer (process-buffer p)) (goto-char (point-min)) (let ((diags (flymake-cc--make-diagnostics source))) (if (or diags (= 0 (process-exit-status p))) (funcall report-fn diags) (funcall report-fn :panic :explanation (buffer-substring (point-min) (progn (goto-char (point-min)) (line-end-position))))))))))) (if (process-live-p p) nil (kill-buffer (process-buffer p)))))(#<process gcc-flymake> "finished\n")
--8<---------------cut here---------------end--------------->8---