Today I wanted to do some tests with a more recent Mail::SpamAssassin than the
ancient one left over on my work workstation.  I did the very usual thing for
this kind of testing:

  $ eval `perl -Mlocal::lib=~/local/sa-3.3.2`
  $ cpanm Mail::SpamAssassin

If you're writing Perl and don't know about local::lib, you should learn.  It's
fantastically useful.  It's a very simple way to maintain alternate,
compartmentalized hunks of @INC/$PATH entries, and is wildly useful for
testing.  Here's the Perl Advent article on it from last year:
http://perladvent.org/2011/2011-12-01.html

Anyway, part of how it works is by setting up your environment for you,
including PERL5LIB.  More or less all of my non-core libraries are installed in
local::libs.  Even if they were not, that's where things were being installed
as prereqs for Mail-SpamAssassin.

Unfortunately, the test suite kept not finding them.  What the heck was going
on?  I was tearing my hair out until I realized that taint mode makes PERL5LIB
meaningless.  It gets entirely ignored.  The SpamAssassin tests do not use -T
in their shebang lines, but they often run external programs, and the SATest.pm
library defaults to adding -T to the perl invocation unless
$ENV{TEST_PERL_TAINT} is set to "no"

I dug this up with some grepping, set the env var, and set the tests running.
Things were passing!  Great!

...until it got to tests that ran spamd.  spamd has -T on its shebang line,
which means that when SATest tries to run it without -T, perl dies with:

  "-T" is on the #! line, it must also be used on the command line

So Mail-SpamAssassin can't, it seems, be tested without taint mode, which means
it can't be tested with PERL5LIB in effect, which means it can't work with
local::lib, which means I am sad.

Here are some options.  I can probably write a patch.

* make Makefile.PL decline to configure the dist if PERL5LIB is set
* remove the -T from the shebang line of spamd
* skip tests that need to run spamd if TEST_PERL_TAINT eq 'no'
* other

Thanks for the software!

-- 
rjbs

Attachment: signature.asc
Description: Digital signature

Reply via email to