-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
rg -Ff fails to find a match in a case where it should #1334
Comments
Ah thanks for this bug report! Literal optimizations are going to be the death me. I introduced this regression when I added an optimization for the The offending line of code is here, which also explains why ripgrep/grep-regex/src/matcher.rs Line 75 in bc37c32
(Specifically, the regex engine, currently, can often search for a small number of literals more quickly than Aho-Corasick, so we were diverting to the regex engine for a smaller number of literals, in which case, using escaped literals is correct.) This is basically one giant mess because all of this should be pushed down into the regex engine, but there's a lot of refactoring work that needs to be done before that can happen. So I tried to paper over it at a higher level and got bit here. Anyway, this should be fixed on master. I'm going to see about getting a patch release out soon. |
Thanks Andrew! I really appreciate both the fix and the explanation - interesting edge case. 😁 |
What version of ripgrep are you using?
How did you install ripgrep?
brew install ripgrep
What operating system are you using ripgrep on?
macos 10.14.6
Describe your question, feature request, or bug.
With specific types of input files, I'm seeing rg -Ff return no matches in cases where it should return a match.
If this is a bug, what are the steps to reproduce the behavior?
patterns contains the same ip prefix 40 times:
corpus is a single line containing the prefix from the patterns file:
this is expected to produce a match, but does not:
treating patterns as non fixed string finds a match:
and strangely, removing a single line from patterns will also find a match:
I haven't dug in enough to see if this purely a result of 39 vs 40 lines, or if it's 39 vs 40 lines and the size of the '1.208.0.0/12' string, but I do seem to be crossing some boundary into buggy behavior with this specific test.
corpus.txt
fewerpatterns.txt
patterns.txt
The text was updated successfully, but these errors were encountered: