Bug 7687 - Mail::SpamAssassin::Plugin::URILocalBL require Geo::IP
Summary: Mail::SpamAssassin::Plugin::URILocalBL require Geo::IP
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Plugins (show other bugs)
Version: 3.4.2
Hardware: PC Linux
: P2 normal
Target Milestone: Undefined
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-01 08:55 UTC by Marco
Modified: 2019-02-04 10:06 UTC (History)
3 users (show)



Attachment Type Modified Status Actions Submitter/CLA Status
let it compile if geoip is not present patch None Giovanni Bechis [HasCLA]

Note You need to log in before you can comment on or make changes to this bug.
Description Marco 2019-02-01 08:55:06 UTC
Plugin Mail::SpamAssassin::Plugin::URILocalBL require Geo::IP even if  GeoIP2::Database::Reader is installed and working.

If GeoIP2::Database::Reader is installed and Geo::IP is not installed plugin fails with:

Bareword "GEOIP_MEMORY_CACHE" not allowed while "strict subs" in use at /usr/share/perl5/vendor_perl/Mail/SpamAssassin/Plugin/URILocalBL.pm line 465.
Bareword "GEOIP_CHECK_CACHE" not allowed while "strict subs" in use at /usr/share/perl5/vendor_perl/Mail/SpamAssassin/Plugin/URILocalBL.pm line 465.
Bareword "GEOIP_ISP_EDITION" not allowed while "strict subs" in use at /usr/share/perl5/vendor_perl/Mail/SpamAssassin/Plugin/URILocalBL.pm line 466.
Bareword "GEOIP_MEMORY_CACHE" not allowed while "strict subs" in use at /usr/share/perl5/vendor_perl/Mail/SpamAssassin/Plugin/URILocalBL.pm line 466.
Bareword "GEOIP_CHECK_CACHE" not allowed while "strict subs" in use at /usr/share/perl5/vendor_perl/Mail/SpamAssassin/Plugin/URILocalBL.pm line 466.
Bareword "GEOIP_MEMORY_CACHE" not allowed while "strict subs" in use at /usr/share/perl5/vendor_perl/Mail/SpamAssassin/Plugin/URILocalBL.pm line 470.
Bareword "GEOIP_CHECK_CACHE" not allowed while "strict subs" in use at /usr/share/perl5/vendor_perl/Mail/SpamAssassin/Plugin/URILocalBL.pm line 470.
Bareword "GEOIP_ISP_EDITION" not allowed while "strict subs" in use at /usr/share/perl5/vendor_perl/Mail/SpamAssassin/Plugin/URILocalBL.pm line 471.
Bareword "GEOIP_MEMORY_CACHE" not allowed while "strict subs" in use at /usr/share/perl5/vendor_perl/Mail/SpamAssassin/Plugin/URILocalBL.pm line 471.
Bareword "GEOIP_CHECK_CACHE" not allowed while "strict subs" in use at /usr/share/perl5/vendor_perl/Mail/SpamAssassin/Plugin/URILocalBL.pm line 471.
Execution of /usr/share/perl5/vendor_perl/Mail/SpamAssassin/Plugin/URILocalBL.pm aborted due to compilation errors.

I don't know if this is a bug or not, maybe Geo::IP is still required anyhow. But it cause a little confusion.
Comment 1 Giovanni Bechis 2019-02-01 22:53:19 UTC
"use constant" is evaluated at compile time while if statements at run time,
so you cannot create a pseudo code like:
if ($condition) {
 use constant ...
} else {
 use constant ...
}
I cannot see any easy solution without adding a parameter to URILocalBL config like it has been done for RelayCountry (country_db_type option).
Comment 2 Henrik Krohns 2019-02-01 23:39:39 UTC
Perhaps just enough to ditch the imports and use $Geo::IP::GEOIP_ISP_EDITION etc.
Comment 3 Giovanni Bechis 2019-02-02 07:29:00 UTC
Created attachment 5641 [details]
let it compile if geoip is not present

This diff make it compile even if geoip is not installed
Comment 4 Marco 2019-02-04 08:55:26 UTC
(In reply to Giovanni Bechis from comment #3)
> Created attachment 5641 [details]
> let it compile if geoip is not present
> 
> This diff make it compile even if geoip is not installed

Wonderful! This patch works for me!
Comment 5 Giovanni Bechis 2019-02-04 10:06:02 UTC
Fixed in r1852885.