In perl.git, the branch blead has been updated

<https://perl5.git.perl.org/perl.git/commitdiff/b3c872ebe7541431109f07330ab5123db843dea1?hp=85a8548711e75aede72b0a6207a64963e01e198e>

- Log -----------------------------------------------------------------
commit b3c872ebe7541431109f07330ab5123db843dea1
Author: Tomasz Konojacki <[email protected]>
Date:   Sat Jan 20 23:54:34 2018 +0100

    loc_tools.pl: untaint _source_location's return value and fix a warning
    
    Some of our tests are running with -T and it turns out that something in
    File::Spec::Unix is the tainting the return value of _source_location().
    
    Additionally, when warnings are enabled globally (with either $^W or -W),
    not passing the last argument (filename) to File::Spec->catpath results in
    an undefined variable warning.

-----------------------------------------------------------------------

Summary of changes:
 t/loc_tools.pl | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/t/loc_tools.pl b/t/loc_tools.pl
index fbe7242b1e..4f0ae2ba17 100644
--- a/t/loc_tools.pl
+++ b/t/loc_tools.pl
@@ -494,11 +494,13 @@ sub _source_location {
 
     my $caller_filename = (caller)[1];
 
-    return File::Spec->rel2abs(
+    my $loc = File::Spec->rel2abs(
         File::Spec->catpath(
-            (File::Spec->splitpath($caller_filename))[0, 1]
+            (File::Spec->splitpath($caller_filename))[0, 1], ''
         )
     );
+
+    return ($loc =~ /^(.*)$/)[0]; # untaint
 }
 
 1

-- 
Perl5 Master Repository

Reply via email to