bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#72312: server--process-filter-1 returns from the wrong block


From: Jeremy Bryant
Subject: bug#72312: server--process-filter-1 returns from the wrong block
Date: Fri, 26 Jul 2024 22:32:53 +0100

Thuna <thuna.cing@gmail.com> writes:

> In `server--process-filter-1' in lisp/server.el I assume the
> `return-from' on line 28 was meant to be from `server--process-filter-1'
> and not `server--process-filter'.

Assuming you mean this last line,

      ;; We return immediately.
      (cl-return-from server--process-filter)))

adding Stefan M, who made a commit in
May and may know more.

commit 0d7d835902dfaeaae03850fb37e369833bb5664d
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Date:   Thu May 30 18:28:02 2024 -0400

    server.el: Avoid nested runs of process filters (bug#71223)







(cl-defun server--process-filter-1 (proc string)
  (server-log (concat "Received " string) proc)
  ;; First things first: let's check the authentication
  (unless (process-get proc :authenticated)
    (if (and (string-match "-auth \\([!-~]+\\)\n?" string)
             (equal (match-string 1 string) (process-get proc :auth-key)))
        (progn
          (setq string (substring string (match-end 0)))
          (process-put proc :authenticated t)
          (server-log "Authentication successful" proc))
      (server-log "Authentication failed" proc)
      ;; Display the error as a message and give the user time to see
      ;; it, in case the error written by emacsclient to stderr is not
      ;; visible for some reason.
      (server--message-sit-for 2 "Authentication failed")
      (server-send-string
       proc (concat "-error " (server-quote-arg "Authentication failed")))
      (unless (eq system-type 'windows-nt)
        (let ((terminal (process-get proc 'terminal)))
          ;; Only delete the terminal if it is non-nil.
          (when (and terminal (eq (terminal-live-p terminal) t))
            (delete-terminal terminal))))
      ;; Before calling `delete-process', give emacsclient time to
      ;; receive the error string and shut down on its own.
      ;; FIXME: Why do we wait 1s here but 5s in the other one?
      (run-with-timer 1 nil #'delete-process proc)
      ;; We return immediately.
      (cl-return-from server--process-filter)))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]