From 99f4a0c7fe30e80bc0c8d9be78b37f97292757c3 Mon Sep 17 00:00:00 2001 From: Yves Orton Date: Mon, 2 Jan 2023 13:28:18 +0100 Subject: 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. --- ext/File-Find/t/taint.t | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) (limited to 'ext') 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 -- cgit v1.2.1