spamhaus / spamassassin-dqs

Spamhaus code for the Spamassassin plugin. See https://docs.spamhaustech.com/40-real-world-usage/SpamAssassin/000-intro.html
Apache License 2.0
54 stars 16 forks source link

Use of uninitialized value in regexp compilation #13

Closed Gazoo closed 5 years ago

Gazoo commented 5 years ago

After installation I get this when running spamassassin --lint

# spamassassin --lint
Jul 17 10:09:58.262 [10213] warn: Use of uninitialized value in regexp compilation at /usr/share/perl5/vendor_perl/Mail/SpamAssassin/Plugin/SH.pm line 69.
Invalid database type 0

OS version:

CentOS Linux release 7.6.1810 (Core) 

SpamAssassin version:

# spamassassin -V
SpamAssassin version 3.4.3-rc2 running on Perl version 5.16.3
Gazoo commented 5 years ago

It looks like that block of code was taken from a very old HashBl.pm. Why not use the updated code that is included by default in the new SpamAssassin?

https://github.com/apache/spamassassin/blob/trunk/lib/Mail/SpamAssassin/Plugin/HashBL.pm#L251

ricalfieri commented 5 years ago

Could you confirm that replacing the $self->{email_re} in SH.pm with the one from HashBL.pm (from SpamAssassin trunk) solves the problem? I don't have a system like your to test it and I'd prefer to wait for 3.4.3 to be officially released before debugging on a release candidate

Gazoo commented 5 years ago

Unfortunately changing $self->{email_regex} to the code from HashBL.pm $self->{email_re} doesn't fix it. I wonder why the HashBL.pm code works fine while the code in SH.pm doesn't ?

ricalfieri commented 5 years ago

Alright, I managed to reproduce the problem. If you do a

spamassassin --lint -D

You'll probably see the lines:

Jul 19 15:34:50.457 [63775] dbg: HashBL: local tests only, disabling HashBL Jul 19 15:34:50.405 [63775] dbg: SHPlugin: local tests only, disabled

The problem is that our plugin doesn't handle very nicely not having network tests enabled, so it throws that error.

I now pushed a fixed version (also with the better email regex, thanks for pointing that out) , but you should check why you have network checks disabled

Gazoo commented 5 years ago

We don't have network tests disabled. Doesn't spamassassin --lint disable network tests automatically? As you can see from our spam stats Pyzor, Razor2, and HashBL all are working without issue.

2019-07-19_08h02_54

ricalfieri commented 5 years ago

Maybe something changed on 3.4.3 .. the error was because the function $self->{main}->{registryboundaries}->{valid_tlds_re} apparently doesn't load when linting (that could make sense if network tests are disabled)

However, did you fetch the latest SH.pm and tried?

Gazoo commented 5 years ago

The updated version doesn't spit out any error now when running spamassassin --lint with SpamAssassin 3.4.3 RC3

Also running spamassassin --lint -D

Jul 19 08:17:21.145 [27428] dbg: SHPlugin: local tests only, disabled

Looks like its fixed. Thanks again!

ricalfieri commented 5 years ago

closing this, thanks to you again for pointing out the outdated regex :)