GNU bug report logs - #63629
28.3; Emacsclient exits with no error message and breaks terminal when opening a file without permissions

Previous Next

Package: emacs;

Reported by: Adam Ibrahim <ibrahimadam193 <at> gmail.com>

Date: Sun, 21 May 2023 18:10:02 UTC

Severity: normal

Found in version 28.3

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #29 received at 63629 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Adam Ibrahim <ibrahimadam193 <at> gmail.com>
Cc: 63629 <at> debbugs.gnu.org
Subject: Re: bug#63629: Fwd: bug#63629: 28.3; Emacsclient exits with no error
 message and breaks terminal when opening a file without permissions
Date: Fri, 26 May 2023 13:29:38 +0300
> From: Adam Ibrahim <ibrahimadam193 <at> gmail.com>
> Date: Wed, 24 May 2023 08:08:13 -0400
> Cc: 63629 <at> debbugs.gnu.org
> 
> Makes sense. Thanks.

I eventually found a way of showing the error message in almost all
cases, and installed the fix with those changes on the master branch.
Please try the patch below and see if it produces better results.

diff --git a/lisp/server.el b/lisp/server.el
index 608e5df..c3325e5 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1143,8 +1143,18 @@ server-process-filter
 	  (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.
+      (message "Authentication failed")
+      (sit-for 2)
       (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.
       (sit-for 1)
@@ -1462,10 +1472,20 @@ server-execute
 
 (defun server-return-error (proc err)
   (ignore-errors
+    ;; 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.
+    (message (error-message-string err))
+    (sit-for 2)
     (server-send-string
      proc (concat "-error " (server-quote-arg
                              (error-message-string err))))
     (server-log (error-message-string err) proc)
+    (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.
     (sit-for 5)




This bug report was last modified 1 year and 357 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.