Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Error with regexp Stack Overflows #131

Merged
merged 2 commits into from
Feb 22, 2023

Conversation

LaurenceWarne
Copy link
Contributor

@LaurenceWarne LaurenceWarne commented Jul 25, 2022

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 🤷), 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!

@alphapapa alphapapa self-assigned this Aug 15, 2022
@alphapapa alphapapa added the bug Something isn't working label Aug 15, 2022
@alphapapa alphapapa added this to the 1.6 milestone Aug 15, 2022
@alphapapa
Copy link
Owner

Thanks. I'll try to merge this soon.

@LaurenceWarne
Copy link
Contributor Author

Great, no rush 🙂

@b40yd
Copy link

b40yd commented Feb 20, 2023

Thanks. I'll try to merge this soon.

I have the same problem.

LaurenceWarne and others added 2 commits February 21, 2023 19:31
Fix "error in process sentinel: Wrong type argument: magit-todos-item,
t" occurring when there's a stack overflow in the regexp matcher,
which is caught and then a warning displayed, but since
display-warning returns a truthy value (t) this truthy value is
treated as a valid todo item by the enclosing --when-let.  The error
is then thrown later when Emacs tries to write its the TODO item in
the magit status buffer.
@alphapapa alphapapa merged commit c6f3fd0 into alphapapa:master Feb 22, 2023
@alphapapa
Copy link
Owner

@LaurenceWarne Thanks for your patience.

@b40yd Thanks for reminding me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants