From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#71576: 30.0.50; [PATCH] Improve performance of Comint/Eshell password prompt handling Date: Sun, 16 Jun 2024 09:45:10 +0200 Message-ID: <87le35gwl5.fsf@gmx.de> References: Reply-To: Michael Albinus Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26693"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 71576@debbugs.gnu.org To: Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 16 09:51:33 2024 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 1sIkfk-0006hW-PV for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 16 Jun 2024 09:51:32 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sIkfH-0003Tj-7r; Sun, 16 Jun 2024 03:51:03 -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 1sIkfF-0003TW-E7 for bug-gnu-emacs@gnu.org; Sun, 16 Jun 2024 03:51:01 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sIkfF-0002yE-69 for bug-gnu-emacs@gnu.org; Sun, 16 Jun 2024 03:51:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sIkfG-0005ua-29 for bug-gnu-emacs@gnu.org; Sun, 16 Jun 2024 03:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 16 Jun 2024 07:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71576 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 71576-submit@debbugs.gnu.org id=B71576.171852422422637 (code B ref 71576); Sun, 16 Jun 2024 07:51:02 +0000 Original-Received: (at 71576) by debbugs.gnu.org; 16 Jun 2024 07:50:24 +0000 Original-Received: from localhost ([127.0.0.1]:34283 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sIkee-0005t3-3L for submit@debbugs.gnu.org; Sun, 16 Jun 2024 03:50:24 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]:42661) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sIkec-0005sl-8F for 71576@debbugs.gnu.org; Sun, 16 Jun 2024 03:50:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1718524213; x=1719129013; i=michael.albinus@gmx.de; bh=iWUw5wQzY8NQeXpeGtz9z16tbtINmdoMlgAJC6VQG4M=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=muQ/K0ampyP5AF/36zipKPl+eBqX2O99+DNMtdcHiMFBRVZbdwdDeTrRJyx4ljR1 Jtghd8WhcMuX1yoZZL7ijkDpOuHCr5ASkMdld1HKchJVbhbkfvVn2clM6EP64EFbM rSRMNEPoSBTLTrNBP7DIjWt6yxaqF93FED0jqFCtsKBxSjvV2sQV3pcszZNwKKYA4 Ib1CfTi9xex7WPJrTaTWAap5/KQ98Tcl1H3iDdifiyxy3nCVLDrJV/skgIdTDXBFH cNvrOUP6oJy0t7KVDcqCpV0hSutgc/iMeBHa9ARnbxEX26qXatEVGpiTpxYtuhE31 +hQpFsorkAfuecrOpw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from gandalf.gmx.de ([185.89.38.155]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N5VDE-1sT8tp1tD0-017Kan; Sun, 16 Jun 2024 09:45:11 +0200 In-Reply-To: (Jim Porter's message of "Sat, 15 Jun 2024 12:50:01 -0700") X-Provags-ID: V03:K1:LFL77v344h/z9vQBze2DTvj8I/b/5MgLnbGrxWuJ18wy2mcAxAd Qi1UhO7B2wlQH8/87mc9dnMyG9cQlgkpj9cchnU5Gk4kfhpXgZi0/Ho2oL41wzVMumAu0Xd QWhNTgEYdIpTsAoljPg6HcQ1Kf33SnsH55ZZs6X2BmOkQp9li74S6/T8q1lojkLh9rIhnUZ jBA8ngSIpsY6ZMT7gO5zQ== UI-OutboundReport: notjunk:1;M01:P0:gY1bI13i/og=;HCDHCEPZXcqBOnLleX+mj9A+CG7 D4VKuMQez4soYAaMuChUiJOb/djVP5gEZi9F0MKb+7cjNp4wYcuKI+7MppwXJrrqO3TLeaJOS p3gJbfPeAR/uZkogLZCeMvpzHgUelVfiTfdtLoNIo3WDuW+xqJDxsc3s9fKOAL7nQOtgxTpju QblT7VnIqFpqNjJijJ9YF1i67Bn/xx9eaLTuVsShRubqvYIqlGggCSnIwRORWCmMIMDMYv2hq fbucMiElB8zHFB1OU8ZvFrZvs5gLjwScwEJQeypPEvy8+9zz5iQFFcecL7TJZz3rez7fP7Q3h mjy7bXcScLd/bZMWq2dtd6MEZqQ+MRkZkHLEJGrDkcTD07aJv5Vw+IhhDohq24pkcIAb21zqQ MJT3jAlEgHZrx1ZvGaFIwuUWCGEoc8ZiuelnYfBnTe2i5DSW14cozjK0Q/W8wG6z1EPUwJjaS 0w06bFmLCozpRpFDGRlkJtjwl3PYVRtRaYwRZ6IUWLsRHabY9/W5STjnsxrsbZlU0mPu3PRlr an6mHzC9E2rDmLBQo0e/lyfdpFSl4YaRwEXNYmp2P3AxfoRCSm3gEYMmndC+Qh86k9Ciy9m3P 0wp6xNE5iwEHHsmylPZ3le5uwJ0+QBTxdNN/8kCWdnklxrpe91QtjoNV7grE60GTnPrVf5eDX cdqVqT1xVltC5mNZg2STi8+cou95hR1PZyZ4dAnFbLkiwinmMi86hUVRdBzVg/UrBkRg8G16b MugGLg23MUfgy3tVleleRWwUKtbjm3wc3G5tjtQK72Bo05N8CSpIJ/m0dD/xN4YcUz6DCzlM 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:287325 Archived-At: Jim Porter writes: Hi Jim, > How long can a password prompt really be? In Comint and Eshell, we > check for output from subprocesses that looks like a password prompt, > so that we can hide the password when the user types it in. That's > good, but for commands that output a lot of text, it can take a while > to scan through it all. > > The attached patch adds a performance optimization for this: since we > only check for password prompts at the end of a block of output (the > subprocess is presumably waiting for the user to type in their > password), we only need to look at the last N characters, where N is > whatever the maximum password prompt length is. There's obviously no > *strict* maximum here, but I can't imagine a password prompt being > longer than 256 characters. Compared to the default > 'read-process-output-max' value of 4096, this means we could skip up > to 93% of the output when looking for the prompt. FTR, Tramp scans output for a prompt from the end for years. It's not only a password prompt, but also a shell prompt it looks for. It restricts itself to 256 characters. --8<---------------cut here---------------start------------->8--- (defun tramp-search-regexp (regexp) "Search for REGEXP backwards, starting at point-max. If found, set point to the end of the occurrence found, and return point. Otherwise, return nil." (goto-char (point-max)) ;; We restrict ourselves to the last 256 characters. There were ;; reports of a shell command "git ls-files -zco --exclude-standard" ;; with 85k files involved, which has blocked Tramp forever. (search-backward-regexp regexp (max (point-min) (- (point) 256)) 'noerror)) --8<---------------cut here---------------end--------------->8--- Best regards, Michael.