From: Michael Albinus <michael.albinus@gmx.de>
To: Daniel Colascione <dancol@dancol.org>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: [PATCH] Really prevent quitting in sensitive contexts
Date: Thu, 12 Mar 2020 11:07:29 +0100 [thread overview]
Message-ID: <87tv2tga3i.fsf@gmx.de> (raw)
In-Reply-To: <7eced910-43dd-5e62-a864-beded660a07e@dancol.org> (Daniel Colascione's message of "Wed, 11 Mar 2020 19:32:18 -0700")
[-- Attachment #1: Type: text/plain, Size: 948 bytes --]
Daniel Colascione <dancol@dancol.org> writes:
>> Are there bug#NNN where these are discussed?
>
> No. The motiviation is Tramp inflooping after a quit because it uses
> with-local-quit inside tramp-accept-process-output, which causes
> tramp-wait-for-regexp to retry infinitely and quickly.
>
> I found *that* behavior trying to figure out why M-x compile over
> Tramp was hanging not only Emacs, but also the SSH connection more
> generally. I *think* it has something to do with compilation-filter
> calling file-truename, which invokes Tramp's handler, which wants to
> talk over the same SSH connection that's spewing compilation messages,
> deadlocking something somewhere.
Please write a bug report, it should be solved in Tramp.
with-local-quit is used in tramp-accept-process-output by
intention. There were reports that Tramp hung, and couldn't be quit ...
Would the appended patch help (completely untested)?
Best regards, Michael.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1342 bytes --]
diff --git a/lisp/tramp.el b/lisp/tramp.el
index 82ac693d..af2bc4b2 100644
--- a/lisp/tramp.el
+++ b/lisp/tramp.el
@@ -4227,18 +4227,20 @@ performed successfully. Any other value means an error."
(defun tramp-accept-process-output (proc &optional timeout)
"Like `accept-process-output' for Tramp processes.
This is needed in order to hide `last-coding-system-used', which is set
-for process communication also."
+for process communication also.
+If the user quits via `C-g', it is propagated up to `tramp-file-name-handler'."
(with-current-buffer (process-buffer proc)
(let ((inhibit-read-only t)
last-coding-system-used
result)
- ;; JUST-THIS-ONE is set due to Bug#12145.
- (tramp-message
- proc 10 "%s %s %s %s\n%s"
- proc timeout (process-status proc)
- (with-local-quit
- (setq result (accept-process-output proc timeout nil t)))
- (buffer-string))
+ ;; JUST-THIS-ONE is set due to Bug#12145. `with-local-quit'
+ ;; returns t in order to report success.
+ (if (with-local-quit
+ (setq result (accept-process-output proc timeout nil t)) t)
+ (tramp-message
+ proc 10 "%s %s %s %s\n%s"
+ proc timeout (process-status proc) result (buffer-string))
+ (keyboard-quit))
result)))
(defun tramp-search-regexp (regexp)
next prev parent reply other threads:[~2020-03-12 10:07 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-12 2:05 [PATCH] Really prevent quitting in sensitive contexts Daniel Colascione
2020-03-12 2:20 ` Stefan Monnier
2020-03-12 2:32 ` Daniel Colascione
2020-03-12 10:07 ` Michael Albinus [this message]
2020-03-12 10:21 ` Robert Pluim
2020-03-12 10:33 ` Michael Albinus
2020-03-13 10:00 ` Michael Albinus
2020-04-14 6:56 ` Daniel Colascione
2020-04-14 8:40 ` Michael Albinus
2020-03-12 3:29 ` Óscar Fuentes
2020-03-12 7:21 ` Eli Zaretskii
2020-03-12 13:31 ` Richard Copley
2020-03-12 17:36 ` Drew Adams
2020-03-12 22:06 ` Stefan Monnier
2020-03-12 23:14 ` Richard Copley
2020-03-12 23:35 ` Stefan Monnier
2020-03-12 23:56 ` Richard Copley
2020-03-14 15:31 ` Drew Adams
2020-03-14 18:21 ` Stefan Monnier
2020-03-14 18:36 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tv2tga3i.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=dancol@dancol.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).