From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Adam Ibrahim 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: Tue, 23 May 2023 16:30:14 -0400 Message-ID: References: <83a5xxr1db.fsf@gnu.org> <83v8gkpk6g.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000001c332605fc62428e" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28603"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63629@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 23 22:31:26 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 1q1YfG-0007M6-IB for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 May 2023 22:31:26 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q1Yeu-0004NZ-V0; Tue, 23 May 2023 16:31:04 -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 1q1Yet-0004Ji-Jv for bug-gnu-emacs@gnu.org; Tue, 23 May 2023 16:31: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 1q1Yet-0004VY-BI for bug-gnu-emacs@gnu.org; Tue, 23 May 2023 16:31:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q1Yes-0001Xe-6a for bug-gnu-emacs@gnu.org; Tue, 23 May 2023 16:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Adam Ibrahim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 23 May 2023 20:31:02 +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.16848738395895 (code B ref 63629); Tue, 23 May 2023 20:31:02 +0000 Original-Received: (at 63629) by debbugs.gnu.org; 23 May 2023 20:30:39 +0000 Original-Received: from localhost ([127.0.0.1]:40480 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q1YeU-0001Wz-Au for submit@debbugs.gnu.org; Tue, 23 May 2023 16:30:38 -0400 Original-Received: from mail-ed1-f50.google.com ([209.85.208.50]:46322) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q1YeR-0001Wm-Rb for 63629@debbugs.gnu.org; Tue, 23 May 2023 16:30:37 -0400 Original-Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-510db954476so534619a12.0 for <63629@debbugs.gnu.org>; Tue, 23 May 2023 13:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684873830; x=1687465830; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=VuGAgIig9bWBZ4vwVJxjxrVreYMUMNbe652mTn9m8ak=; b=IxjXZ7YK98wWJ3yHNZcCcszTpHkMYi6HTbD9dWBSNkFhfnF4oqJDE98GtCjqwOSlP7 O0c/gG6AETu/O7DjyXJa7z1prSgS7TlzOK+uFSUH6Q4w1ssWG33LkhjEF497DA+oSCAY Axq2kywZRCiIMaws/fQGGtQ1WyPVxymK1BmxIn8eiTetCPKSlB4ufydLmtsHJjUsBv3I d7LpgB+fnF3XMdGvsjoOItrL5UQko4knIeCM9LOy4+aD/rkT/tYeZQBpOAEIsNmREHtA TCHO6gnExjS/D/V0tEFOJ1FdxRxRxPZP7Jcw8GTiyB4G6/SFGNWbo/bO0GVCEuyUjH9y hFvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684873830; x=1687465830; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VuGAgIig9bWBZ4vwVJxjxrVreYMUMNbe652mTn9m8ak=; b=ZQkyfUlQdWoTp/YnDIhCP0unC326ZBBBB6szSaC4KGfsgR6drduwJxY+PG4pxvTz59 9Tsle1rj2mwG+G9h5fd9GY1QW0Za29Bel76YeEGfExEaVgdquiBvZu68NIn0OsKZ9VQR pun56n5DZzKDXc+3K4Q2cZfyF36+EAls1fz8u1k+1Drl7OfX40SQPm3OxDA2NLQ9+5Mx +OeTSzQQYM5KRS0qFMul/yS4tfCmAQyTfNm6N5p9uzAyHY4WzWR0r/d8nnEDqMFByw5F KPkpW7JR7gL/FTukxbdAqsJBzO3QlWxbaagSTKOV6vM+wWq2KqKwngICxuWmcz8zPp32 LB/Q== X-Gm-Message-State: AC+VfDxIWVTd5JqJe/+8jLivj/S2RHMaqtWR1WXBCyO6KsQw7bI80NNz yjSs92poRLpA/yySZD1f/p3Ss03Pt1zo80gXdEc= X-Google-Smtp-Source: ACHHUZ7lDjlCs7PekZmXaGBQLp1neF5BYoG+OBFO63izGkt76w85CC6DptqbaumDpV13/2DANI/Hbirhcim8tn2Wu44= X-Received: by 2002:a17:907:6288:b0:96a:316f:8abf with SMTP id nd8-20020a170907628800b0096a316f8abfmr15549685ejc.20.1684873829690; Tue, 23 May 2023 13:30:29 -0700 (PDT) In-Reply-To: <83v8gkpk6g.fsf@gnu.org> 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:262252 Archived-At: --0000000000001c332605fc62428e Content-Type: text/plain; charset="UTF-8" I ran the following commands on my phone in termux and in Kitty on my PC 10 times each and record the results. I did it multiple times because the results seem random. ./src/emacs --fg-daemon -Q ./lib-src/emacsclient path/to/no-perms # in a separate terminal, 10 times Phone + Termux: 9 out of 10 times, I got the expected results where the terminal was not broken and I saw an error message. on the 10th time there was some weird behavior, but I haven't been able to reproduce it and I don't remember what happened. PC + Kitty: there were no crashes meaning the terminal wasn't broken anymore. but 6 out of 10 times the error message didn't print. sometimes all I saw was "waiting for emacs..." and some other times all I saw was "...". the other four times was expected behavior colon the error message printed and the terminal wasn't broken. Note: I have a slightly different environment on my phone compared to the first time. when I first reported the bug I was using the emacs and emacsclient programs located on my phone. this time I used the modified emacs and emacsclient from my desktop over SSH. I don't know if that changed the results. But the bug with unmodified emacs happens just the same over SSH as with emacs on my phone. On Mon, May 22, 2023, 09:30 Eli Zaretskii wrote: > > From: Adam Ibrahim > > Date: Sun, 21 May 2023 14:57:03 -0400 > > > > output of `ls -l`: > > > > ls -l no-perms > > ---------- 1 u0_a331 u0_a331 0 May 21 14:27 no-perms > > > > commands used: > > > > emacs --fg-daemon -Q > > emacsclient no-perms # in a separate terminal > > > > what stops working: when I type, the letters I type don't appear in the > terminal anymore. nothing is > > echoed back to me. stuff still happens, and I can enter commands, but I > can't see anything. And the > > terminal width seems screwed up. like things that should get indented, > they don't look right. > > Thanks. Please try the patch below and see if it solves the problem > without adding any new ones. > > diff --git a/lisp/server.el b/lisp/server.el > index eaf24a770e4..7e35eaa6176 100644 > --- a/lisp/server.el > +++ b/lisp/server.el > @@ -1138,6 +1138,11 @@ server-process-filter > (server-log "Authentication failed" proc) > (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) > @@ -1459,6 +1464,11 @@ server-return-error > 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) > --0000000000001c332605fc62428e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I ran the following commands on my phone in termux and in= Kitty on my PC 10 times each and record the results. I did it multiple tim= es because the results seem random.

=C2=A0./src/emacs --fg-daemon -Q
=C2=A0./lib-s= rc/emacsclient path/to/no-perms # in a separate terminal, 10 times

Phone + Termux: 9 out of 10 time= s, I got the expected results where the terminal was not broken and I saw a= n error message. on the 10th time there was some weird behavior, but I have= n't been able to reproduce it and I don't remember what happened.

PC + Kitty: there were no= crashes meaning the terminal wasn't broken anymore. but 6 out of 10 ti= mes the error message didn't print. sometimes all I saw was "waiti= ng for emacs..." and some other times all I saw was "...". t= he other four times was expected behavior colon the error message printed a= nd the terminal wasn't broken.

Note: I have a slightly different environment on my phone compar= ed to the first time. when I first reported the bug I was using the emacs a= nd emacsclient programs located on my phone. this time I used the modified = emacs and emacsclient from my desktop over SSH. I don't know if that ch= anged the results. But the bug with unmodified emacs happens just the same = over SSH as with emacs on my phone.

On Mon, May 22, 2023, 09:30 Eli Za= retskii <eliz@gnu.org> wrote:
=
> From: Adam Ibrahim <ibra= himadam193@gmail.com>
> Date: Sun, 21 May 2023 14:57:03 -0400
>
> output of `ls -l`:
>
>=C2=A0 ls -l no-perms
>=C2=A0 ---------- 1 u0_a331 u0_a331 0 May 21 14:27 no-perms
>
> commands used:
>
>=C2=A0 emacs --fg-daemon -Q
>=C2=A0 emacsclient no-perms # in a separate terminal
>
> what stops working: when I type, the letters I type don't appear i= n the terminal anymore. nothing is
> echoed back to me. stuff still happens, and I can enter commands, but = I can't see anything. And the
> terminal width seems screwed up. like things that should get indented,= they don't look right.

Thanks.=C2=A0 Please try the patch below and see if it solves the problem without adding any new ones.

diff --git a/lisp/server.el b/lisp/server.el
index eaf24a770e4..7e35eaa6176 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1138,6 +1138,11 @@ server-process-filter
=C2=A0 =C2=A0 =C2=A0 =C2=A0(server-log "Authentication failed" pr= oc)
=C2=A0 =C2=A0 =C2=A0 =C2=A0(server-send-string
=C2=A0 =C2=A0 =C2=A0 =C2=A0 proc (concat "-error " (server-quote-= arg "Authentication failed")))
+=C2=A0 =C2=A0 =C2=A0 (unless (eq system-type 'windows-nt)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 (let ((terminal (process-get proc 'termina= l)))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; Only delete the terminal if it is no= n-nil.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (when (and terminal (eq (terminal-live-= p terminal) t))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(delete-terminal terminal))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0;; Before calling `delete-process', give ema= csclient time to
=C2=A0 =C2=A0 =C2=A0 =C2=A0;; receive the error string and shut down on its= own.
=C2=A0 =C2=A0 =C2=A0 =C2=A0(sit-for 1)
@@ -1459,6 +1464,11 @@ server-return-error
=C2=A0 =C2=A0 =C2=A0 proc (concat "-error " (server-quote-arg
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (error-message-string err))))
=C2=A0 =C2=A0 =C2=A0(server-log (error-message-string err) proc)
+=C2=A0 =C2=A0 (unless (eq system-type 'windows-nt)
+=C2=A0 =C2=A0 =C2=A0 (let ((terminal (process-get proc 'terminal))) +=C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; Only delete the terminal if it is non-nil.<= br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 (when (and terminal (eq (terminal-live-p termi= nal) t))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(delete-terminal terminal))))
=C2=A0 =C2=A0 =C2=A0;; Before calling `delete-process', give emacsclien= t time to
=C2=A0 =C2=A0 =C2=A0;; receive the error string and shut down on its own. =C2=A0 =C2=A0 =C2=A0(sit-for 5)
--0000000000001c332605fc62428e--