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 ambiguous wrong recognized date pattern resp. its optional parts #1512

Merged
merged 4 commits into from Aug 15, 2016

Conversation

sebres
Copy link
Contributor

@sebres sebres commented Aug 15, 2016

amend to (long time ago fixed left word-boundary) b6bb2f8: datepattern right word-boundary - prevents confusions if end of date-pattern (e.g. optional year part) misleadingly match not date values (see gh-1507)

test cases extended to check ambiguous "unbound" patterns in log lines (match/miss resp. positive/negative cases)

…ns if end of date-pattern (e.g. optional year part) misleadingly match not date values (see fail2bangh-1507)

test cases extended to check ambiguous "unbound" patterns in log lines (match/miss resp. positive/negative cases)
@coveralls
Copy link

coveralls commented Aug 15, 2016

Coverage Status

Changes Unknown when pulling 7f55be3 on sebres:_fix/datepattern-right-word-boundary into * on fail2ban:0.9*.

@sebres
Copy link
Contributor Author

sebres commented Aug 15, 2016

This does not fix directly #1507, but will prevent in the future such wrong recognition also without specifying of exact date-pattern.

In addition, such boundaries (as well as left or right) make the search of date much faster, in particular after merging in our faster branch 0.10...

@codecov-io
Copy link

codecov-io commented Aug 15, 2016

Current coverage is 89.61% (diff: 100%)

Merging #1512 into 0.9 will increase coverage by 0.08%

@@                0.9      #1512   diff @@
==========================================
  Files            69         69          
  Lines          7362       7377    +15   
  Methods           0          0          
  Messages          0          0          
  Branches       1022       1025     +3   
==========================================
+ Hits           6591       6611    +20   
+ Misses          601        595     -6   
- Partials        170        171     +1   

Powered by Codecov. Last update c49fe12...7f55be3

@@ -64,7 +64,7 @@ def name(self, name):
def getRegex(self):
return self._regex

def setRegex(self, regex, wordBegin=True):
def setRegex(self, regex, wordBegin=True, wordEnd=True):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is even a docstring with description of wordbegin... Would be nice to note the wordend there I guess

@yarikoptic
Copy link
Member

Since tests pass, I guess it doesn't ruin any date matching and I am cool to have it merged. But we need a change log entry stating that dates now are checked to end at the words boundary.

@coveralls
Copy link

coveralls commented Aug 15, 2016

Coverage Status

Changes Unknown when pulling 0bdee25 on sebres:_fix/datepattern-right-word-boundary into * on fail2ban:0.9*.

@sebres
Copy link
Contributor Author

sebres commented Aug 15, 2016

Done, if tests pass, I'll merge it into both branches (0.9 and 0.10)

@coveralls
Copy link

coveralls commented Aug 15, 2016

Coverage Status

Changes Unknown when pulling 9935cf1 on sebres:_fix/datepattern-right-word-boundary into * on fail2ban:0.9*.

@sebres sebres merged commit f61aa32 into fail2ban:0.9 Aug 15, 2016
@sebres sebres deleted the _fix/datepattern-right-word-boundary branch August 15, 2016 18:11
@sebres sebres mentioned this pull request Sep 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants