Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Can't get @INC via eval `` in taint mode, revert to default value.

  • Loading branch information...
commit 10a9cc8f2897fa0418f4b0b5159605a29cc392fd 1 parent 3286afb
@guillaumeaubert guillaumeaubert authored
Showing with 23 additions and 17 deletions.
  1. +23 −17 lib/Devel/Cover.pm
View
40 lib/Devel/Cover.pm
@@ -113,26 +113,32 @@ BEGIN
}
else
{
- eval
+ # Can't get @INC via eval `` in taint mode, revert to default value.
+ if ( ${^TAINT} )
{
- local %ENV = %ENV;
- # Clear *PERL* variables, but keep PERL5?LIB for local::lib
- # environments
- /perl/i and !/^PERL5?LIB$/ and delete $ENV{$_} for keys %ENV;
- my $cmd = "$^X -MData::Dumper -e " . '"print Dumper \@INC"';
- my $VAR1;
- # print STDERR "Running [$cmd]\n";
- eval `$cmd`;
- # TODO - Devel::Cover: Error getting @INC: Insecure dependency in ``
- # while running with -T switch at .../Devel/Cover.pm line 116.
- @Inc = @$VAR1;
- };
- if ($@)
- {
- print STDERR __PACKAGE__, ": Error getting \@INC: $@\n",
- "Reverting to default value for Inc.\n";
@Inc = @Devel::Cover::Inc::Inc;
}
+ else
+ {
+ eval
+ {
+ local %ENV = %ENV;
+ # Clear *PERL* variables, but keep PERL5?LIB for local::lib
+ # environments
+ /perl/i and !/^PERL5?LIB$/ and delete $ENV{$_} for keys %ENV;
+ my $cmd = "$^X -MData::Dumper -e " . '"print Dumper \@INC"';
+ my $VAR1;
+ # print STDERR "Running [$cmd]\n";
+ eval `$cmd`;
+ @Inc = @$VAR1;
+ };
+ if ($@)
+ {
+ print STDERR __PACKAGE__, ": Error getting \@INC: $@\n",
+ "Reverting to default value for Inc.\n";
+ @Inc = @Devel::Cover::Inc::Inc;
+ }
+ }
}
@Inc = map { -d $_ ? ($_ eq "." ? $_ : Cwd::abs_path($_)) : () } @Inc;
Please sign in to comment.
Something went wrong with that request. Please try again.