spamassassin doesn't use modified @INC
Hello list, I'm in the progress of setting up a new Server with amavisd-new and spamassassin. I like to run the recent versions of this programms, but therefore I need some perl modules from cpan (e.g. IP::Country::Fast), because they are not in the repository of my distribution (SLES 11). The guy who installed these modules, installed them in /usr/local/perl/ and they should be available in perl: # perl -V Summary of my perl5 (revision 5 version 10 subversion 0) configuration: (...) %ENV: PERL5LIB=/usr/local/perl/lib:/usr/local/perl/lib/arch @INC: /usr/local/perl/lib /usr/local/perl/lib/arch /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl # perl -we 'use IP::Country::Fast; print $IP::Country::Fast::VERSION,\n' 604.001 But spamassassin (and amavisd) doesn't find the additional modules. [9427] dbg: metadata: failed to load 'IP::Country::Fast', skipping (Can't locate IP/Country/Fast.pm in @INC (@INC contains: lib /usr/lib/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/5.10.0/x86_64-linux-thread- multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl/5.10.0/x86_64-linux- thread-multi /usr/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl) at /usr/lib/perl5/vendor_perl/5.10.0/Mail/SpamAssassin/Plugin/RelayCountry.pm line 68. My question is now: How can I tell spamassassin to use the right (modified) @INC array? Greetings Stefan signature.asc Description: This is a digitally signed message part.
Re: spamassassin doesn't use modified @INC
Stefan, I'm in the progress of setting up a new Server with amavisd-new and spamassassin. I like to run the recent versions of this programms, but therefore I need some perl modules from cpan (e.g. IP::Country::Fast), because they are not in the repository of my distribution (SLES 11). The guy who installed these modules, installed them in /usr/local/perl/ and they should be available in perl: # perl -V Summary of my perl5 (revision 5 version 10 subversion 0) configuration: (...) %ENV: PERL5LIB=/usr/local/perl/lib:/usr/local/perl/lib/arch @INC: /usr/local/perl/lib /usr/local/perl/lib/arch /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl # perl -we 'use IP::Country::Fast; print $IP::Country::Fast::VERSION,\n' 604.001 But spamassassin (and amavisd) doesn't find the additional modules. [9427] dbg: metadata: failed to load 'IP::Country::Fast', skipping (Can't locate IP/Country/Fast.pm in @INC (@INC contains: lib /usr/lib/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/5.10.0/x86_64-linux-thread- multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl/5.10.0/x86_64-linux- thread-multi /usr/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl) at /usr/lib/perl5/vendor_perl/5.10.0/Mail/SpamAssassin/Plugin/RelayCountry.pm line 68. amavisd does not modify @INC nor use the 'use lib' pragma/module. %ENV: PERL5LIB=/usr/local/perl/lib:/usr/local/perl/lib/arch Note that amavisd runs in taint mode, so this will be ignored by perl according to its perlrun documentation: PERL5LIB A list of directories in which to look for Perl library files before looking in the standard library and the current directory. Any architecture-specific directories under the specified locations are automatically included if they exist. If PERL5LIB is not defined, PERLLIB is used. Directories are separated (like in PATH) by a colon on unixish platforms and by a semicolon on Windows (the proper path separator being given by the command perl -V:path_sep). When running taint checks (either because the program was running setuid or setgid, or the -T switch was used), neither variable is used. The program should instead say: use lib /my/directory; My question is now: How can I tell spamassassin to use the right (modified) @INC array? It would be simplest to install missing modules in one of the perl-default directories, such as /usr/lib/perl5/site_perl/5.10.0/ . Or try adding: use lib your-directory at the start of file amavisd. Mark
Re: spamassassin doesn't use modified @INC
Mark Martinec: Stefan, snip amavisd does not modify @INC nor use the 'use lib' pragma/module. %ENV: PERL5LIB=/usr/local/perl/lib:/usr/local/perl/lib/arch Note that amavisd runs in taint mode, so this will be ignored by perl according to its perlrun documentation: snip When running taint checks (either because the program was running setuid or setgid, or the -T switch was used), neither variable is used. The program should instead say: use lib /my/directory; My question is now: How can I tell spamassassin to use the right (modified) @INC array? It would be simplest to install missing modules in one of the perl-default directories, such as /usr/lib/perl5/site_perl/5.10.0/ . Or try adding: use lib your-directory at the start of file amavisd. I added use lib '/usr/local/perl/lib'; to /etc/amavisd.conf and it seams to work. Are there any disadvantages in placing the use lib pragma there instead of in amavisd? Mark Thank you, Mark. Greetings Stefan signature.asc Description: This is a digitally signed message part.
Re: spamassassin doesn't use modified @INC
Stefan, It would be simplest to install missing modules in one of the perl-default directories, such as /usr/lib/perl5/site_perl/5.10.0/ . Or try adding: use lib your-directory at the start of file amavisd. I added use lib '/usr/local/perl/lib'; to /etc/amavisd.conf and it seams to work. Are there any disadvantages in placing the use lib pragma there instead of in amavisd? That would be alright, if it works for you. The amavisd.conf is loaded slightly later than the first pass of main initialization, but apparently early enough for your needs. Mark