View Issue Details

IDProjectCategoryView StatusLast Update
0006002unrealircdpublic2021-12-01 09:02
Reportersrhuston Assigned Tosyzop  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinuxOSRHELOS Version7
Product Version6.0.0-beta2 
Fixed in Version6.0.0-rc2 
Summary0006002: SPAMFILTER regex fails to match
DescriptionSimilarly to 0005913 I had trouble getting spamfilters to match, including the very example given in the helpop output. I finally tried using the regex ".*come to irc\..+\..+.*" instead of the provided "/come to irc\..+\..+/" and was able to make it work properly. I then edited the regex to make it slightly more complex which also worked. It seems like the PCRE '/.../' delimiters aren't working perhaps? I tried to trace through the code to look more but my C is quite rusty anymore.
Steps To Reproduce* /spamfilter add -regex cN gzline 1d No_advertising_please /come to irc\..+\..+/
* say "come to irc.foo.bar" in channel
* nothing happens
* /spamfilter add -regex cN gzline 1d No_advertising_please .*come to irc\..+\..+.*
* say "come to irc.foo.bar" in channel
* B&
TagsNo tags attached.
3rd party modules

Activities

syzop

2021-11-18 17:03

administrator   ~0022192

Could not find something quickly in https://www.pcre.org/changelog.txt but I may have glanced over it.

Which PCRE2 version are you using? You can tell from the boot screen (eg "./unrealircd configtest")

srhuston

2021-11-18 18:20

reporter   ~0022193

* PCRE2 10.36 2020-12-04

Looking through config.log I think it was packaged with the git clone? The system version on the machine is pcre-8.32-17.el7.x86_64 so I don't think it linked to that one:

PCRE2_CFLAGS='-I/home/ircd/Installs/unrealircd/unrealircd.git/extras/pcre2/include'

syzop

2021-11-19 19:30

administrator   ~0022194

Have not looked at this yet, but, for what its worth, the PCRE2 versions in UnrealIRCd 5 and UnrealIRCd 6 are currently both at 10.36.
It is at 10.36 since March 8 2021, which is 5.0.9.

syzop

2021-11-29 18:30

administrator   ~0022224

Ah ok, now that I actually read and try what you do I understand what you mean. I don't think anywhere we tell people to use / at start and end. And the behavior is also not new, it also exists in UnrealIRCd 5.

So yeah, let's close this :). Thanks for going through everything though, who knows you may catch some real U6 issue.. always good to have people test!

srhuston

2021-11-29 18:57

reporter   ~0022226

Ok, glad it's not a code issue then - but it is spelled out that way in doc/conf/help/help.conf:

        " /spamfilter add -regex cN gzline 1d No_advertising_please /come to irc\..+\..+/";

So knowing PCRE expressions are often delimited with /.../ I copied and pasted that which failed. Seems inconsistent between the languages:

doc/conf/help/help.conf: " /spamfilter add -regex cN gzline 1d No_advertising_please /come to irc\..+\..+/";
doc/conf/help/help.de.conf: " /spamfilter add cN gzline 1d No_advertising_please come to irc\..+\..+";
doc/conf/help/help.fr.conf: " /spamfilter add -regex cN gzline 1d No_advertising_please /come to irc\..+\..+/";
doc/conf/help/help.it.conf: " /spamfilter add -regex cN gzline 1d No_advertising_please /come to irc\..+\..+/";
doc/conf/help/help.nl.conf: " /spamfilter voeg -regex cN gzline 1d No_advertising_please /come to irc\..+\..+/";
doc/conf/help/help.pl.conf: " /spamfilter add -regex cN gzline 1d No_advertising_please /come to irc\..+\..+/";
doc/conf/help/help.ru.conf: " /spamfilter add cN gzline 1d No_advertising_please come to irc\..+\..+";

srhuston

2021-11-29 18:58

reporter   ~0022227

Ugh.. I think I put that in the wrong place, not used to this bug tracker :/

syzop

2021-12-01 09:02

administrator   ~0022233

You did perfectly fine :)

I see... HELPOP is wrong then indeed. I traced back how that change in HELPOP happened. Apparently when I introduced the -simple option, and thus -regex for regex, I changed the examples for regex to include slashes at start and end. I think I did that to make it look more like a regex and make it immediately clear that it is different from -simple with wildcards. I totally did not remember that.

I have now removed those slashes again as you are right that they are not working so that is rather confusing. Thanks again for the report :)

https://github.com/unrealircd/unrealircd/commit/d77a5be834fc89a33311c6fecdb4190953a32526
commit d77a5be834fc89a33311c6fecdb4190953a32526 (HEAD -> unreal60_dev, origin/unreal60_dev)
Author: Bram Matthys <[email protected]>
Date: Wed Dec 1 08:59:35 2021 +0100

    Don't use slashes at start and end in SPAMFILTER example in HELPOP.
    Reported by srhuston in https://bugs.unrealircd.org/view.php?id=6002
    [skip ci]

Issue History

Date Modified Username Field Change
2021-11-17 17:47 srhuston New Issue
2021-11-18 16:00 syzop Severity minor => major
2021-11-18 17:03 syzop Note Added: 0022192
2021-11-18 18:20 srhuston Note Added: 0022193
2021-11-19 19:30 syzop Note Added: 0022194
2021-11-29 18:30 syzop Assigned To => syzop
2021-11-29 18:30 syzop Status new => closed
2021-11-29 18:30 syzop Resolution open => no change required
2021-11-29 18:30 syzop Note Added: 0022224
2021-11-29 18:57 srhuston Status closed => feedback
2021-11-29 18:57 srhuston Resolution no change required => reopened
2021-11-29 18:57 srhuston Note Added: 0022226
2021-11-29 18:58 srhuston Note Added: 0022227
2021-12-01 09:02 syzop Status feedback => resolved
2021-12-01 09:02 syzop Resolution reopened => fixed
2021-12-01 09:02 syzop Fixed in Version => 6.0.0-rc2
2021-12-01 09:02 syzop Note Added: 0022233