From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Really prevent quitting in sensitive contexts Date: Thu, 12 Mar 2020 11:07:29 +0100 Message-ID: <87tv2tga3i.fsf@gmx.de> References: <20200312020554.194607-1-dancol@dancol.org> <7eced910-43dd-5e62-a864-beded660a07e@dancol.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="17632"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Stefan Monnier , emacs-devel@gnu.org To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 12 11:10:15 2020 Return-path: Envelope-to: ged-emacs-devel@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 1jCKn8-0004Hm-Ty for ged-emacs-devel@m.gmane-mx.org; Thu, 12 Mar 2020 11:10:14 +0100 Original-Received: from localhost ([::1]:38770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCKn7-0004A8-KA for ged-emacs-devel@m.gmane-mx.org; Thu, 12 Mar 2020 06:10:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34844) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCKki-0002QH-OG for emacs-devel@gnu.org; Thu, 12 Mar 2020 06:07:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCKkh-0000PP-HV for emacs-devel@gnu.org; Thu, 12 Mar 2020 06:07:44 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]:33165) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jCKkh-0000NY-4Q for emacs-devel@gnu.org; Thu, 12 Mar 2020 06:07:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1584007651; bh=r5LsB9wUATR1kkmDLCKOZs/uDeGqWBtO6PhzGdDD3TI=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=IAZrx4MZgKKKWjFyraiYnJBnKJglwrqRRqCencd/Z9237dD0Ywj21fowevp/rkwm1 V4Io5kY5VkacYYrnsTUenRrK7hKpApA7axTQHKHULvYU88rfX9sUM8eET4IBVoEoGd 0BB4c9YfJKGnA4c4ZO9Kc/JCCgfGiM9P+sociqyI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from detlef.gmx.de ([79.140.124.1]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M72oB-1jFN9w1qox-008YEU; Thu, 12 Mar 2020 11:07:31 +0100 In-Reply-To: <7eced910-43dd-5e62-a864-beded660a07e@dancol.org> (Daniel Colascione's message of "Wed, 11 Mar 2020 19:32:18 -0700") X-Provags-ID: V03:K1:aPciirZ/l4211pBo+5otRtxUGMyp9WHESQ3PxupoAPYYCIh7qdK 8MgjKK8BzFDY1jStcrRU8v7nR6+gexPmXEVGd4hRy8LGpk/MFaTeNCc5NxoK9Sy3Rlcnc0n VE1QfSv33zy5qGvDonCpi93GMKT3OApCnhlYYy1ku8pGRKWwVDRjmQoidM8P0K1gE38dI5s C9QOZDCJC9Rvx/hSVpp/g== X-UI-Out-Filterresults: notjunk:1;V03:K0:H7O+uuRPyrk=:chprNEASEzDFBuc4I0mDa4 Zrdu1c6BzSXHea1KlrBUZ/46dyQ6CtR+WZOIL2GNFONbKe1yFpnGCzRTXocKtjPq3hvI0YLRI +PtxUfMBfZ9vwEuINKGcTKDeZmybEFhT0m/MXBks1HboTMeAQoa/Q2bOyVS29+XNYWUIHA7nW IeAZ3laMC2CMPBbQ0B3yYsL9+ynhVKgEchyAoNwrAQVsPyHyYg9DDJBxDgoPeh/BqmLOY93lr HirVddkE8y2S1u9pOpW/paDlDs4S1RhHK5tpGm6qXNE/535DK3Muo0GaExOMl58yMc3crXyfM ltey/ICvi3ETAEfahILPRAk7se+fgH8yKAIseZh8HnhGvDJQJSnTbxytlX8VW0E2O0dFbN9hm 3UjkRT4i6FoNr/rKnxb8BxFlOTj857A5hyw+3jn9khVD5dy/CBp48h5tF7ST76vShv/H7IICo K+1EEyxCDiUdinFma+/VPftbmNP/tVd0QqkM+9Ilq1rzTZmBe3J36KUVCsjriM59H0jArplOj MAttjTA4B7YOyfn0bMTRus0+7kVkYKb6L9W4iubyBG6f8QYfaUT2DgFpRoIaqJILO42fq4u8S IfJBn+kJcYdxmN7p5cwyp9MmtWJ9CBh1QsOszkt8cbixx8flOnFwcOu2wJMZM/6BJP36ubD8y UR5sEHaDuwy1I438cLeJwOFeHKx+Q5o4oeWtuqx0RBXQ7BgBQFCwpUEey8d0+owEYSrJuzjoC TXt5l+EhIrqi/myygyJ/4HK4YcBT4QKSIGDP1w0B6EykbcIRcD9S5opTv22m70oIPAMQsLDI X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.20 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:245486 Archived-At: --=-=-= Content-Type: text/plain Daniel Colascione 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. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Transfer-Encoding: quoted-printable diff --git a/lisp/tramp.el b/lisp/tramp.el index 82ac693d..af2bc4b2 100644 =2D-- 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-hand= ler'." (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) --=-=-=--