This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix PathTools taint handling for Perl 5.6
authorZefram <zefram@fysh.org>
Thu, 20 Jul 2017 05:32:27 +0000 (06:32 +0100)
committerZefram <zefram@fysh.org>
Thu, 20 Jul 2017 05:32:27 +0000 (06:32 +0100)
PathTools's reserve code for detecting tainted values on Perl 5.6
generated a warning if the value was undefined, which it commonly was.
Make it allow all undefined values (which get filtered out in the next
step) without warning.  Its test script for tainting behaviour also failed
to detect whether tainting was turned on on Perl 5.6, incorrectly skipping
the test script on the basis that the Perl doesn't support tainting.
Switch that check to an empirical arrangement that works on any Perl.

13 files changed:
dist/PathTools/Changes
dist/PathTools/Cwd.pm
dist/PathTools/lib/File/Spec.pm
dist/PathTools/lib/File/Spec/AmigaOS.pm
dist/PathTools/lib/File/Spec/Cygwin.pm
dist/PathTools/lib/File/Spec/Epoc.pm
dist/PathTools/lib/File/Spec/Functions.pm
dist/PathTools/lib/File/Spec/Mac.pm
dist/PathTools/lib/File/Spec/OS2.pm
dist/PathTools/lib/File/Spec/Unix.pm
dist/PathTools/lib/File/Spec/VMS.pm
dist/PathTools/lib/File/Spec/Win32.pm
dist/PathTools/t/taint.t

index 7d0c179..c3c53ed 100644 (file)
@@ -1,5 +1,9 @@
 Revision history for Perl distribution PathTools.
 
+3.68
+- avoid warning from pre-5.8 code for detecting tainted values
+- make taint.t detect that a pre-5.8 Perl supports tainting
+
 3.67 - Mon Feb 27 09:33:04 EST 2017
 - Add security usage note to File::Spec::no_upwards
 
index ce142cf..cc77e58 100644 (file)
@@ -3,7 +3,7 @@ use strict;
 use Exporter;
 use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION);
 
-$VERSION = '3.67';
+$VERSION = '3.68';
 my $xs_version = $VERSION;
 $VERSION =~ tr/_//d;
 
index a9a7619..aa2a5c8 100644 (file)
@@ -3,7 +3,7 @@ package File::Spec;
 use strict;
 use vars qw(@ISA $VERSION);
 
-$VERSION = '3.67';
+$VERSION = '3.68';
 $VERSION =~ tr/_//d;
 
 my %module = (MacOS   => 'Mac',
index 8d3796e..0af106c 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use vars qw(@ISA $VERSION);
 require File::Spec::Unix;
 
-$VERSION = '3.67';
+$VERSION = '3.68';
 $VERSION =~ tr/_//d;
 
 @ISA = qw(File::Spec::Unix);
index 745df86..bffeb3d 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use vars qw(@ISA $VERSION);
 require File::Spec::Unix;
 
-$VERSION = '3.67';
+$VERSION = '3.68';
 $VERSION =~ tr/_//d;
 
 @ISA = qw(File::Spec::Unix);
index 959261a..a911b5e 100644 (file)
@@ -3,7 +3,7 @@ package File::Spec::Epoc;
 use strict;
 use vars qw($VERSION @ISA);
 
-$VERSION = '3.67';
+$VERSION = '3.68';
 $VERSION =~ tr/_//d;
 
 require File::Spec::Unix;
index cb7532e..71f0e6a 100644 (file)
@@ -5,7 +5,7 @@ use strict;
 
 use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION);
 
-$VERSION = '3.67';
+$VERSION = '3.68';
 $VERSION =~ tr/_//d;
 
 require Exporter;
index 192cc8d..31e7a4d 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use vars qw(@ISA $VERSION);
 require File::Spec::Unix;
 
-$VERSION = '3.67';
+$VERSION = '3.68';
 $VERSION =~ tr/_//d;
 
 @ISA = qw(File::Spec::Unix);
index 1e201eb..71ef5ac 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use vars qw(@ISA $VERSION);
 require File::Spec::Unix;
 
-$VERSION = '3.67';
+$VERSION = '3.68';
 $VERSION =~ tr/_//d;
 
 @ISA = qw(File::Spec::Unix);
index ff3599a..e1a30f8 100644 (file)
@@ -3,7 +3,7 @@ package File::Spec::Unix;
 use strict;
 use vars qw($VERSION);
 
-$VERSION = '3.67';
+$VERSION = '3.68';
 my $xs_version = $VERSION;
 $VERSION =~ tr/_//d;
 
@@ -185,7 +185,8 @@ sub _tmpdir {
        @dirlist = grep { ! Scalar::Util::tainted($_) } @dirlist;
     }
     elsif ($] < 5.007) { # No ${^TAINT} before 5.8
-       @dirlist = grep { eval { eval('1'.substr $_,0,0) } } @dirlist;
+       @dirlist = grep { !defined($_) || eval { eval('1'.substr $_,0,0) } }
+                       @dirlist;
     }
     
     foreach (@dirlist) {
index fb4351f..20630c7 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use vars qw(@ISA $VERSION);
 require File::Spec::Unix;
 
-$VERSION = '3.67';
+$VERSION = '3.68';
 $VERSION =~ tr/_//d;
 
 @ISA = qw(File::Spec::Unix);
index 17f1c5a..9dc6cb0 100644 (file)
@@ -5,7 +5,7 @@ use strict;
 use vars qw(@ISA $VERSION);
 require File::Spec::Unix;
 
-$VERSION = '3.67';
+$VERSION = '3.68';
 $VERSION =~ tr/_//d;
 
 @ISA = qw(File::Spec::Unix);
index 48f8c5b..9515470 100644 (file)
@@ -11,7 +11,7 @@ use lib File::Spec->catdir('t', 'lib');
 use Test::More;
 BEGIN {
     plan(
-        ${^TAINT}
+       !eval { eval("1".substr($^X,0,0)) }
         ? (tests => 21)
         : (skip_all => "A perl without taint support")
     );