unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: Pierre Neidhardt <mail@ambrevar.xyz>
Cc: Stefan Kangas <stefan@marxist.se>,
	28329@debbugs.gnu.org, Pierre Neidhardt <ambrevar@gmail.com>
Subject: bug#28329: 25.2; Eshell: 40M+ output: Stack overflow in regexp matcher
Date: Sun, 30 Jun 2019 09:45:16 -0400	[thread overview]
Message-ID: <87h8875gr7.fsf@gmail.com> (raw)
In-Reply-To: <87d0ivipfc.fsf@ambrevar.xyz> (Pierre Neidhardt's message of "Sun, 30 Jun 2019 07:59:35 +0200")

[-- Attachment #1: Type: text/plain, Size: 611 bytes --]

Pierre Neidhardt <mail@ambrevar.xyz> writes:

> So I never got around reproducing the issue with Gentoo, and soon after
> I dropped Gentoo and moved to Guix, with which I've never been able to
> re-experience this issue, even on massive Eshell buffers (couple of 10M...).
>
> As far as I'm concerned, this could be closed, but maybe another Gentoo
> user out there would be able to tell us more.

Oh yeah, I still have a possible fix sitting in my local repo.
Attaching here for posterity, but I wouldn't want to apply it unless we
actually know that it would help (because it might break legitimate
matches).


[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1264 bytes --]

From 7a3bdc88941f90c5506165ddf4b9d12f51ba9ea3 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sat, 2 Sep 2017 08:17:48 -0400
Subject: [PATCH] [?] Only match password prompts in part of line (Bug#28329)

* lisp/eshell/esh-mode.el (eshell-password-prompt-regexp): Add
beginning of line anchor, and use {,80} instead of * to restrict
matches in long lines.
---
 lisp/eshell/esh-mode.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index 80844c3a64..9f80700c6a 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -179,7 +179,10 @@ eshell-preoutput-filter-functions
   :group 'eshell-mode)
 
 (defcustom eshell-password-prompt-regexp
-  (format "\\(%s\\)[^::៖]*[::៖]\\s *\\'" (regexp-opt password-word-equivalents))
+  ;; Assume prompt will show up near the beginning of a line, this
+  ;; should prevent excessive regexp searches on long lines.
+  (format "^.\\{,80\\}%s[^::៖]\\{,80\\}[::៖]\\s-*\\'"
+          (regexp-opt password-word-equivalents))
   "Regexp matching prompts for passwords in the inferior process.
 This is used by `eshell-watch-for-password-prompt'."
   :type 'regexp
-- 
2.11.0


  parent reply	other threads:[~2019-06-30 13:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-02  9:34 bug#28329: 25.2; Eshell: 40M+ output: Stack overflow in regexp matcher Pierre Neidhardt
2017-09-02 12:30 ` npostavs
2017-09-02 13:27   ` Pierre Neidhardt
2017-09-03  2:19 ` npostavs
2017-09-24 12:55   ` Noam Postavsky
2017-10-21  1:20     ` Noam Postavsky
2017-11-05 13:58       ` Pierre Neidhardt
2017-11-05 14:44         ` Noam Postavsky
2017-11-05 14:54           ` Pierre Neidhardt
2019-06-30  4:58 ` Stefan Kangas
2019-06-30  5:59   ` Pierre Neidhardt
2019-06-30  7:07     ` Stefan Kangas
2019-06-30 13:45     ` Noam Postavsky [this message]
2019-06-30 14:48 ` Mattias Engdegård

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=87h8875gr7.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=28329@debbugs.gnu.org \
    --cc=ambrevar@gmail.com \
    --cc=mail@ambrevar.xyz \
    --cc=stefan@marxist.se \
    /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).