On 2011.5.31 2:58 AM, David Cantrell via RT wrote:
Show quoted text> I like to sometimes test stuff with Tainting turned on. Taking, as an
> example, Tie::Hash::Vivify, it passes all its tests thus:
>
> $ for i in t/*.t; do PERL5OPT=-T /path/to/bin/perl -Mblib $i;done
>
> but when I try to 'make test' with PERL5OPT=-T then Test::Harness dies
> horribly:
>
> $ PERL5OPT=-T make test
> PERL_DL_NONLAZY=1 /home/david/cpantesting/perl-5.14.0/bin/perl
> "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib',
> 'blib/arch')" t/*.t
> Can't load TAP::Formatter::Console at
> /home/david/cpantesting/perl-5.14.0/lib/5.14.0/Test/Harness.pm line 256
> make: *** [test_dynamic] Error 255
I don't think Test::Harness will pass along its tainting flag, so even if TH
could run under taint mode the above approach wouldn't work. And MakeMaker
would also have to run in taint mode... I'm kinda surprised it got that far.
The normal way to turn on tainting in a test is to put the -T line in the #!
line in the .t file. Otherwise if you want to run a one off, prove has a -T
flag to turn on tainting in the tests. Finally, for full control, you can
pass in the -T switch to TAP::Harness->new with the "switches" option.
There also used to be HARNESS_PERL_SWITCHES to control the switches passed
along, but that appears to have disappeared from the docs. Its still in the
code... I don't know if that was deliberate. It sure was useful. That's what
you'd set to cover 'make test'.
Unless you really want Test::Harness itself to operate in taint mode, can we
call this not-a-bug?
--
Life is like a sewer - what you get out of it depends on what you put into it.
- Tom Lehrer