"Insecure dependency in eval" when loading CHI driver

16 views
Skip to first unread message

Mike Friedman

unread,
Nov 22, 2009, 11:45:03 PM11/22/09
to Perl-Cache Discuss
Hi,

I just ran into this error which is causing one of my tests for
CGI::Application::Plugin::CHI to fail:

t/05-default.t .. 1/4 Could not load class (CHI::Driver::Memory)
because : Could not load class (CHI::Driver) because : Insecure
dependency in eval while running with -T switch at /govdoc/lib/
perl5/5.10.0/Module/Load/Conditional.pm line 332, <GEN0> line 6.

I'm not sure if this is a problem with the Module::Load code or CHI
itself, as I've never run into this particular error before, so I'm
not sure where to start tracking it down. Some time tomorrow I'll
probably have some more time to slog through the stack trace, which is
reproduced for your enjoyment below. Any pointers would be
appreciated.


-Mike


Full stack trace:

t/05-default.t .. 1/4 Could not load class (CHI::Driver::Memory)
because : Could not load class (CHI::Driver) because : Insecure
dependency in eval while running with -T switch at /govdoc/lib/
perl5/5.10.0/Module/Load/Conditional.pm line 332, <GEN0> line 6.
Compilation failed in require at /govdoc/lib/perl5/site_perl/5.10.0/
CHI/Driver.pm line 9.
BEGIN failed--compilation aborted at /govdoc/lib/perl5/site_perl/
5.10.0/CHI/Driver.pm line 9.
Compilation failed in require at /govdoc/lib/perl5/site_perl/5.10.0/
i686-linux/Class/MOP.pm line 135.
at /govdoc/lib/perl5/site_perl/5.10.0/i686-linux/Class/MOP.pm line
120
Class::MOP::load_first_existing_class('CHI::Driver') called
at /govdoc/lib/perl5/site_perl/5.10.0/i686-linux/Class/MOP.pm line 141
Class::MOP::load_class('CHI::Driver') called at /govdoc/lib/
perl5/site_perl/5.10.0/Moose/Meta/Class.pm line 234
Moose::Meta::Class::superclasses('Moose::Meta::Class=HASH
(0x8b18be0)', 'CHI::Driver') called at /govdoc/lib/perl5/site_perl/
5.10.0/Moose.pm line 51
Moose::extends('CHI::Driver::Memory', 'CHI::Driver') called
at /govdoc/lib/perl5/site_perl/5.10.0/Moose/Exporter.pm line 320
Moose::extends('CHI::Driver') called at /govdoc/lib/perl5/
site_perl/5.10.0/CHI/Driver/Memory.pm line 8
require CHI/Driver/Memory.pm called at /govdoc/lib/perl5/
site_perl/5.10.0/i686-linux/Class/MOP.pm line 135
eval {...} called at /govdoc/lib/perl5/site_perl/5.10.0/i686-
linux/Class/MOP.pm line 135
Class::MOP::_try_load_one_class('CHI::Driver::Memory') called
at /govdoc/lib/perl5/site_perl/5.10.0/i686-linux/Class/MOP.pm line 97
Class::MOP::load_first_existing_class('CHI::Driver::Memory')
called at /govdoc/lib/perl5/site_perl/5.10.0/i686-linux/Class/MOP.pm
line 141
Class::MOP::load_class('CHI::Driver::Memory') called at /
govdoc/lib/perl5/site_perl/5.10.0/CHI.pm line 33
CHI::new('CHI', 'driver', 'Memory') called at /home/
govdoc/.cpan/build/CGI-Application-Plugin-CHI-0.01-qjMEQc/blib/lib/CGI/
Application/Plugin/CHI.pm line 99
CGI::Application::Plugin::CHI::_get_cache('main=HASH
(0x8649248)', 'ARRAY(0x8649298)') called at /home/govdoc/.cpan/build/
CGI-Application-Plugin-CHI-0.01-qjMEQc/blib/lib/CGI/Application/Plugin/
CHI.pm line 65
CGI::Application::Plugin::CHI::cache('main=HASH(0x8649248)',
'foo') called at t/05-default.t line 14
Compilation failed in require at /govdoc/lib/perl5/site_perl/5.10.0/
i686-linux/Class/MOP.pm line 135.
at /govdoc/lib/perl5/site_perl/5.10.0/i686-linux/Class/MOP.pm line
120
Class::MOP::load_first_existing_class('CHI::Driver::Memory')
called at /govdoc/lib/perl5/site_perl/5.10.0/i686-linux/Class/MOP.pm
line 141
Class::MOP::load_class('CHI::Driver::Memory') called at /
govdoc/lib/perl5/site_perl/5.10.0/CHI.pm line 33
CHI::new('CHI', 'driver', 'Memory') called at /home/
govdoc/.cpan/build/CGI-Application-Plugin-CHI-0.01-qjMEQc/blib/lib/CGI/
Application/Plugin/CHI.pm line 99
CGI::Application::Plugin::CHI::_get_cache('main=HASH
(0x8649248)', 'ARRAY(0x8649298)') called at /home/govdoc/.cpan/build/
CGI-Application-Plugin-CHI-0.01-qjMEQc/blib/lib/CGI/Application/Plugin/
CHI.pm line 65
CGI::Application::Plugin::CHI::cache('main=HASH(0x8649248)',
'foo') called at t/05-default.t line 14
# Looks like you planned 4 tests but ran 1.
# Looks like your test exited with 9 just after 1.
t/05-default.t .. Dubious, test returned 9 (wstat 2304, 0x900)
Failed 3/4 subtests
t/pod.t ......... ok

Test Summary Report
-------------------
t/03-cache.t (Wstat: 2304 Tests: 1 Failed: 0)
Non-zero exit status: 9
Parse errors: Bad plan. You planned 15 tests but ran 1.
t/04-rmcache.t (Wstat: 2304 Tests: 1 Failed: 0)
Non-zero exit status: 9
Parse errors: Bad plan. You planned 7 tests but ran 1.
t/05-default.t (Wstat: 2304 Tests: 1 Failed: 0)
Non-zero exit status: 9
Parse errors: Bad plan. You planned 4 tests but ran 1.
Files=7, Tests=20, 4 wallclock secs ( 0.03 usr 0.03 sys + 1.21
cusr 0.17 csys = 1.44 CPU)
Result: FAIL
Failed 3/7 test programs. 0/20 subtests failed.
FRIEDO/CGI-Application-Plugin-CHI-0.01.tar.gz
./Build test -- NOT OK
//hint// to see the cpan-testers results for installing this module,
try:
reports FRIEDO/CGI-Application-Plugin-CHI-0.01.tar.gz
Running Build install
make test had returned bad status, won't install without force
[govdoc@ip-10-250-11-129 httpd]$ perl -MCHI::Driver::Memory
Can't locate CHI/Driver/Memory.pm in @INC (@INC contains: /usr/local/
lib/perl5/site_perl/5.10.0/i386-linux-thread-multi /usr/local/lib/
perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-
thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/
vendor_perl /usr/lib/perl5/5.10.0/i386-linux-thread-multi /usr/lib/
perl5/5.10.0 /usr/lib/perl5/site_perl .).
BEGIN failed--compilation aborted.

Jonathan Swartz

unread,
Nov 23, 2009, 1:25:29 AM11/23/09
to perl-cach...@googlegroups.com
Could you post the source of the test as well?
> --
>
> You received this message because you are subscribed to the Google
> Groups "Perl-Cache Discuss" group.
> To post to this group, send email to perl-cach...@googlegroups.com
> .
> To unsubscribe from this group, send email to perl-cache-disc...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/perl-cache-discuss?hl=
> .
>
>

Mike Friedman

unread,
Nov 23, 2009, 1:44:09 AM11/23/09
to perl-cach...@googlegroups.com
Sure, here it is. The test blows up at line 14:

my $testc = $obj->cache( 'foo' );

which is when it first tries to instantiate a CHI cache using the Memory driver.

I suppose I could just turn off taint-checking on the test as a
temporary fix, but that doesn't solve the problem of why this error
occurs in the first place. There doesn't appear to be any tainted
data.

Mike


#!perl -T

use strict;
use warnings;

use Test::More tests => 4;

use_ok( 'CGI::Application::Plugin::CHI' );

main->cache_config( foo => { driver => 'Memory' } );

my $obj = bless { }, 'main';

my $testc = $obj->cache( 'foo' );
$testc->set( dog => 'snoopy' );
is( $testc->get( 'dog' ), 'snoopy' );

eval {
my $c = $obj->cache;
};

like( $@, qr/no default cache/ );

main->cache_default( 'foo' );

is( $obj->cache->get( 'dog' ), 'snoopy' );

Jonathan Swartz

unread,
Nov 23, 2009, 6:17:17 AM11/23/09
to perl-cach...@googlegroups.com
I'm pretty unfamiliar with taint. But let me know if you find
something that can be changed in CHI to fix this without causing other
harm.

Mike Friedman

unread,
Nov 23, 2009, 12:07:06 PM11/23/09
to perl-cach...@googlegroups.com
I've determined that it's definitely a problem with ML::Conditional
and not CHI. It does some very weird regexing and eval stuff do parse
out the module version number and that's what's breaking. I'll see if
I can puzzle it out and submit a patch.


Mike

Mike Friedman

unread,
Nov 24, 2009, 1:07:18 PM11/24/09
to perl-cach...@googlegroups.com
Upgrading ML::Conditional seems to have made the problem magically disappear.

In the meantime I'm also uploading a new version of CAP::CHI which
fixes a couple outstanding bugs.

Mike
Reply all
Reply to author
Forward
0 new messages