diff options
author | Yves Orton <demerphq@gmail.com> | 2023-01-02 13:28:18 +0100 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2023-01-04 10:06:16 +0100 |
commit | 99f4a0c7fe30e80bc0c8d9be78b37f97292757c3 (patch) | |
tree | 541ab1a303d76c6ea33de026002bf7960ac38920 /ext | |
parent | da66f78dd1bed16e1553de5fe708bcbe1cd8dd2b (diff) | |
download | perl-99f4a0c7fe30e80bc0c8d9be78b37f97292757c3.tar.gz |
File-Find/t/taint.t - do not use rel2abs after we have forced to Unix mode
taint.t corrupts @INC, by using rel2abs twice on its values, once after
we have forced File::Spec to think we are on a *nix style platform. This
breaks use statements that occur after the second rel2abs. Comparing to
File-Find/t/find.t which also does this we can see that find.t only does
this rel2abs on @INC behavior once. Presumably the second call was a
rebase error of some sort.
This reorganizes the use statements and ensures that we only use
rel2abs() to change @INC prior to overriding it to use *nix semantics.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/File-Find/t/taint.t | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/ext/File-Find/t/taint.t b/ext/File-Find/t/taint.t index 26e7a81f22..592685d63a 100644 --- a/ext/File-Find/t/taint.t +++ b/ext/File-Find/t/taint.t @@ -1,5 +1,6 @@ #!./perl -T use strict; +use lib qw( ./t/lib ); BEGIN { require File::Spec; @@ -18,16 +19,10 @@ BEGIN { require File::Find; import File::Find; } - use Test::More; -BEGIN { - plan( - ${^TAINT} - ? (tests => 45) - : (skip_all => "A perl without taint support") - ); -} -use lib qw( ./t/lib ); +use File::Find; +use File::Spec; +use Cwd; use Testing qw( create_file_ok mkdir_ok @@ -36,21 +31,21 @@ use Testing qw( file_path ); use Errno (); +use Config; + +BEGIN { + plan( + ${^TAINT} + ? (tests => 45) + : (skip_all => "A perl without taint support") + ); +} my %Expect_File = (); # what we expect for $_ my %Expect_Name = (); # what we expect for $File::Find::name/fullname my %Expect_Dir = (); # what we expect for $File::Find::dir my ($cwd, $cwd_untainted); -BEGIN { - require File::Spec; - if ($ENV{PERL_CORE}) { - # May be doing dynamic loading while @INC is all relative - @INC = map { $_ = File::Spec->rel2abs($_); /(.*)/; $1 } @INC; - } -} - -use Config; BEGIN { if ($^O ne 'VMS') { @@ -78,10 +73,6 @@ BEGIN { my $symlink_exists = eval { symlink("",""); 1 }; -use File::Find; -use File::Spec; -use Cwd; - my $orig_dir = cwd(); ( my $orig_dir_untainted ) = $orig_dir =~ m|^(.+)$|; # untaint it |