Skip to content

Commit

Permalink
Windows needs access to path to find DLL files. so you can't clear it…
Browse files Browse the repository at this point in the history
… for some taint tests
  • Loading branch information
toddr authored and jkeenan committed Sep 3, 2020
1 parent 1c15d92 commit da0a32f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions t/op/taint.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ $| = 1;

my $ipcsysv; # did we manage to load IPC::SysV?

my ($old_env_path, $old_env_dcl_path, $old_env_term);
my ($old_env_path, $old_env_dcl_path, $old_env_term, $untainted_path);
BEGIN {
$old_env_path = $ENV{'PATH'};
($untainted_path) = $ENV{'PATH'} =~ m/(.*)/;
$old_env_dcl_path = $ENV{'DCL$PATH'};
$old_env_term = $ENV{'TERM'};
if ($^O eq 'VMS' && !defined($Config{d_setenv})) {
Expand Down Expand Up @@ -140,7 +141,7 @@ my $TEST = 'TEST';
{
$ENV{'DCL$PATH'} = '' if $Is_VMS;

$ENV{PATH} = ($Is_Cygwin) ? '/usr/bin' : '';
$ENV{PATH} = ($Is_Cygwin) ? '/usr/bin' : $Is_MSWin32 ? $old_env_path : '';
delete @ENV{@MoreEnv};
$ENV{TERM} = 'dumb';

Expand Down Expand Up @@ -1276,6 +1277,7 @@ violates_taint(sub { link $TAINT, '' }, 'link');

# Operations which affect directories can't use tainted data.
{
local $ENV{'PATH'} = $untainted_path if $Is_MSWin32;
violates_taint(sub { mkdir "foo".$TAINT, 0755 . $TAINT0 }, 'mkdir');
violates_taint(sub { rmdir $TAINT }, 'rmdir');
violates_taint(sub { chdir "foo".$TAINT }, 'chdir');
Expand Down Expand Up @@ -1317,6 +1319,7 @@ violates_taint(sub { link $TAINT, '' }, 'link');
{
my $foo = $TAINT;

local $ENV{'PATH'} = $untainted_path if $Is_MSWin32;
SKIP: {
skip "open('|') is not available", 8 if $^O eq 'amigaos';

Expand Down Expand Up @@ -1792,6 +1795,7 @@ TODO: {
todo_skip 'tainted %ENV warning occludes tainted arguments warning', 22
if $Is_VMS;

local $ENV{'PATH'} = $untainted_path if $Is_MSWin32;
# bug 20020208.005 (#8465) plus some single arg exec/system extras
violates_taint(sub { exec $TAINT, $TAINT }, 'exec');
violates_taint(sub { exec $TAINT $TAINT }, 'exec');
Expand Down

0 comments on commit da0a32f

Please sign in to comment.