magit-todos icon indicating copy to clipboard operation
magit-todos copied to clipboard

Fix Error with regexp Stack Overflows

Open LaurenceWarne opened this issue 1 year ago • 2 comments

Hi, I kept getting error in process sentinel: Wrong type argument: magit-todos-item, t whenever I opened the magit status buffer for a file in the https://github.com/github/linguist repo.

I found that when a stack overflow occurred during regexp matching (display-warning 'magit-todos (concat "File has lines too long for Emacs to search. Consider excluding it from scans: " filename)) was returning t, which was causing the enclosing --when-let to treat the t as a todo item and add it to the list of todo items, which caused the above error when writing it to a buffer.

AFAICS the doc for display-warning doesn't say anything about its return value ((display-warning 'foo "foo") returns t :shrug:), so for surety this PR just adds nil to the next line.

I can reproduce it with minimal config using the following:

  1. git clone https://github.com/github/linguist (though I think any repo with an uber line will do, e.g. this file is the culprit in that repo: https://github.com/github/linguist/blob/master/test/fixtures/Data/bootstrap.css.map)
  2. ./makem.sh interactive
  3. magit-todos-mode, magit
  4. Open any file in the repo, wait a bit

Thanks!

LaurenceWarne avatar Jul 25 '22 10:07 LaurenceWarne

Thanks. I'll try to merge this soon.

alphapapa avatar Aug 15 '22 21:08 alphapapa

Great, no rush :slightly_smiling_face:

LaurenceWarne avatar Aug 16 '22 14:08 LaurenceWarne

Thanks. I'll try to merge this soon.

I have the same problem.

b40yd avatar Feb 20 '23 03:02 b40yd

@LaurenceWarne Thanks for your patience.

@b40yd Thanks for reminding me.

alphapapa avatar Feb 22 '23 01:02 alphapapa