From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: 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 Message-ID: <837csvl71p.fsf@gnu.org> References: <83a5xxr1db.fsf@gnu.org> <83v8gkpk6g.fsf@gnu.org> <83lehengr4.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20148"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63629@debbugs.gnu.org To: Adam Ibrahim Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 26 12:30:21 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q2UiD-000540-62 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 26 May 2023 12:30:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2Uhx-0004jh-Cy; Fri, 26 May 2023 06:30:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2Uhv-0004jW-Jo for bug-gnu-emacs@gnu.org; Fri, 26 May 2023 06:30:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q2Uhv-00060P-BL for bug-gnu-emacs@gnu.org; Fri, 26 May 2023 06:30:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q2Uhv-000662-4v for bug-gnu-emacs@gnu.org; Fri, 26 May 2023 06:30:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 26 May 2023 10:30:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63629 X-GNU-PR-Package: emacs Original-Received: via spool by 63629-submit@debbugs.gnu.org id=B63629.168509696123334 (code B ref 63629); Fri, 26 May 2023 10:30:03 +0000 Original-Received: (at 63629) by debbugs.gnu.org; 26 May 2023 10:29:21 +0000 Original-Received: from localhost ([127.0.0.1]:48926 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2UhE-00064I-Hf for submit@debbugs.gnu.org; Fri, 26 May 2023 06:29:20 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:47490) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2Uh8-00063v-Vc for 63629@debbugs.gnu.org; Fri, 26 May 2023 06:29:19 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2Uh3-0005pH-Is; Fri, 26 May 2023 06:29:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=xLVjovKhSXpoMToQyL1mb2bL2BCtCoMvjPgW3egZFDA=; b=nA3voAPNoUaG OSaVAtQSfA4xfGMdIPvPISxDDmvldeoopLkPu450I8Awws13KlFktRYtQdYRlGW2woJT6bPXTe9hQ 39RizP6ulzlRnIyvVs1pyZuJupybqy+Rw1vw3Km6TFwkf7abXJkwg+e8bNeju5gMucqhmw4+ex8EC mt5BJ89wTqqr6LSteeZLuUTVTYYZDdzcmbaBDPhSGGGjGT5zC09vz4UuPrmOEmsEVNnd9LQpr++ZU lLgOMDXdAD4pAw85DrvwUALk4yr8Mxbxk5s9WpxMEKU+N+Q1DGw9Id2mNfZYu+rns5/C2gnqLc32P tNvdMCJ1+Va9t2+pjt4U7A==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2Uh2-0007Na-0G; Fri, 26 May 2023 06:29:08 -0400 In-Reply-To: (message from Adam Ibrahim on Wed, 24 May 2023 08:08:13 -0400) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:262424 Archived-At: > From: Adam Ibrahim > Date: Wed, 24 May 2023 08:08:13 -0400 > Cc: 63629@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)