diff options
author | 2019-02-13 21:15:00 +0000 | |
---|---|---|
committer | 2019-02-13 21:15:00 +0000 | |
commit | 9f11ffb7133c203312a01e4b986886bc88c7d74b (patch) | |
tree | 6618511204c614b20256e4ef9dea39a7b311d638 /gnu/usr.bin/perl/dist/PathTools/lib/File | |
parent | Import perl-5.28.1 (diff) | |
download | wireguard-openbsd-9f11ffb7133c203312a01e4b986886bc88c7d74b.tar.xz wireguard-openbsd-9f11ffb7133c203312a01e4b986886bc88c7d74b.zip |
Fix merge issues, remove excess files - match perl-5.28.1 dist
looking good sthen@, Great! bluhm@
Diffstat (limited to 'gnu/usr.bin/perl/dist/PathTools/lib/File')
9 files changed, 54 insertions, 107 deletions
diff --git a/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec.pm b/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec.pm index 3ef0f339db3..85327ee0da3 100644 --- a/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec.pm +++ b/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec.pm @@ -1,16 +1,14 @@ package File::Spec; use strict; -use vars qw(@ISA $VERSION); -$VERSION = '3.63_01'; +our $VERSION = '3.74'; $VERSION =~ tr/_//d; -my %module = (MacOS => 'Mac', +my %module = ( MSWin32 => 'Win32', os2 => 'OS2', VMS => 'VMS', - epoc => 'Epoc', NetWare => 'Win32', # Yes, File::Spec::Win32 works on NetWare. symbian => 'Win32', # Yes, File::Spec::Win32 works on symbian. dos => 'OS2', # Yes, File::Spec::OS2 works on DJGPP. @@ -21,7 +19,7 @@ my %module = (MacOS => 'Mac', my $module = $module{$^O} || 'Unix'; require "File/Spec/$module.pm"; -@ISA = ("File::Spec::$module"); +our @ISA = ("File::Spec::$module"); 1; @@ -158,10 +156,13 @@ Returns a string representation of the parent directory. =item no_upwards -Given a list of file names, strip out those that refer to a parent -directory. (Does not strip symlinks, only '.', '..', and equivalents.) +Given a list of files in a directory (such as from C<readdir()>), +strip out C<'.'> and C<'..'>. - @paths = File::Spec->no_upwards( @paths ); +B<SECURITY NOTE:> This does NOT filter paths containing C<'..'>, like +C<'../../../../etc/passwd'>, only literal matches to C<'.'> and C<'..'>. + + @paths = File::Spec->no_upwards( readdir $dirhandle ); =item case_tolerant diff --git a/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Cygwin.pm b/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Cygwin.pm index 10b14c4b9a6..ed646a160fd 100644 --- a/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Cygwin.pm +++ b/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Cygwin.pm @@ -1,13 +1,12 @@ package File::Spec::Cygwin; use strict; -use vars qw(@ISA $VERSION); require File::Spec::Unix; -$VERSION = '3.63_01'; +our $VERSION = '3.74'; $VERSION =~ tr/_//d; -@ISA = qw(File::Spec::Unix); +our @ISA = qw(File::Spec::Unix); =head1 NAME diff --git a/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Epoc.pm b/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Epoc.pm index 9b9e1fae587..58f74a33ca2 100644 --- a/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Epoc.pm +++ b/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Epoc.pm @@ -1,13 +1,12 @@ package File::Spec::Epoc; use strict; -use vars qw($VERSION @ISA); -$VERSION = '3.63_01'; +our $VERSION = '3.74'; $VERSION =~ tr/_//d; require File::Spec::Unix; -@ISA = qw(File::Spec::Unix); +our @ISA = qw(File::Spec::Unix); =head1 NAME diff --git a/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Functions.pm b/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Functions.pm index a4e1b1bb338..9af6352dd24 100644 --- a/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Functions.pm +++ b/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Functions.pm @@ -3,16 +3,14 @@ package File::Spec::Functions; use File::Spec; use strict; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION); - -$VERSION = '3.63_01'; +our $VERSION = '3.74'; $VERSION =~ tr/_//d; require Exporter; -@ISA = qw(Exporter); +our @ISA = qw(Exporter); -@EXPORT = qw( +our @EXPORT = qw( canonpath catdir catfile @@ -24,7 +22,7 @@ require Exporter; path ); -@EXPORT_OK = qw( +our @EXPORT_OK = qw( devnull tmpdir splitpath @@ -35,7 +33,7 @@ require Exporter; case_tolerant ); -%EXPORT_TAGS = ( ALL => [ @EXPORT_OK, @EXPORT ] ); +our %EXPORT_TAGS = ( ALL => [ @EXPORT_OK, @EXPORT ] ); require File::Spec::Unix; my %udeps = ( diff --git a/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Mac.pm b/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Mac.pm index 22424f32510..a1b044d152a 100644 --- a/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Mac.pm +++ b/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Mac.pm @@ -1,18 +1,13 @@ package File::Spec::Mac; use strict; -use vars qw(@ISA $VERSION); +use Cwd (); require File::Spec::Unix; -$VERSION = '3.63_01'; +our $VERSION = '3.74'; $VERSION =~ tr/_//d; -@ISA = qw(File::Spec::Unix); - -my $macfiles; -if ($^O eq 'MacOS') { - $macfiles = eval { require Mac::Files }; -} +our @ISA = qw(File::Spec::Unix); sub case_tolerant { 1 } @@ -121,7 +116,7 @@ doesn't alter the path, i.e. these arguments are ignored. (When a "" is passed as the first argument, it has a special meaning, see (6)). This way, a colon ":" is handled like a "." (curdir) on Unix, while an empty string "" is generally ignored (see -C<Unix-E<gt>canonpath()> ). Likewise, a "::" is handled like a ".." +L<File::Spec::Unix/canonpath()> ). Likewise, a "::" is handled like a ".." (updir), and a ":::" is handled like a "../.." etc. E.g. catdir("a",":",":","b") = ":a:b:" @@ -168,7 +163,7 @@ their Unix counterparts: # (e.g. "HD:a:") However, this approach is limited to the first arguments following -"root" (again, see C<Unix-E<gt>canonpath()> ). If there are more +"root" (again, see L<File::Spec::Unix/canonpath()>. If there are more arguments that move up the directory tree, an invalid path going beyond root can be created. @@ -343,27 +338,11 @@ sub devnull { =item rootdir -Returns a string representing the root directory. Under MacPerl, -returns the name of the startup volume, since that's the closest in -concept, although other volumes aren't rooted there. The name has a -trailing ":", because that's the correct specification for a volume -name on Mac OS. - -If Mac::Files could not be loaded, the empty string is returned. +Returns the empty string. Mac OS has no real root directory. =cut -sub rootdir { -# -# There's no real root directory on Mac OS. The name of the startup -# volume is returned, since that's the closest in concept. -# - return '' unless $macfiles; - my $system = Mac::Files::FindFolder(&Mac::Files::kOnSystemDisk, - &Mac::Files::kSystemFolderType); - $system =~ s/:.*\Z(?!\n)/:/s; - return $system; -} +sub rootdir { '' } =item tmpdir @@ -669,7 +648,7 @@ sub abs2rel { # Figure out the effective $base and clean it up. if ( !defined( $base ) || $base eq '' ) { - $base = $self->_cwd(); + $base = Cwd::getcwd(); } elsif ( ! $self->file_name_is_absolute( $base ) ) { $base = $self->rel2abs( $base ) ; @@ -737,7 +716,7 @@ sub rel2abs { if ( ! $self->file_name_is_absolute($path) ) { # Figure out the effective $base and clean it up. if ( !defined( $base ) || $base eq '' ) { - $base = $self->_cwd(); + $base = Cwd::getcwd(); } elsif ( ! $self->file_name_is_absolute($base) ) { $base = $self->rel2abs($base) ; diff --git a/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/OS2.pm b/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/OS2.pm index 0119042c9c0..e961ad4e333 100644 --- a/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/OS2.pm +++ b/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/OS2.pm @@ -1,13 +1,13 @@ package File::Spec::OS2; use strict; -use vars qw(@ISA $VERSION); +use Cwd (); require File::Spec::Unix; -$VERSION = '3.63_01'; +our $VERSION = '3.74'; $VERSION =~ tr/_//d; -@ISA = qw(File::Spec::Unix); +our @ISA = qw(File::Spec::Unix); sub devnull { return "/dev/nul"; @@ -30,11 +30,6 @@ sub path { return @path; } -sub _cwd { - # In OS/2 the "require Cwd" is unnecessary bloat. - return Cwd::sys_cwd(); -} - sub tmpdir { my $cached = $_[0]->_cached_tmpdir(qw 'TMPDIR TEMP TMP'); return $cached if defined $cached; @@ -148,7 +143,7 @@ sub abs2rel { # Figure out the effective $base and clean it up. if ( !defined( $base ) || $base eq '' ) { - $base = $self->_cwd(); + $base = Cwd::getcwd(); } elsif ( ! $self->file_name_is_absolute( $base ) ) { $base = $self->rel2abs( $base ) ; } else { @@ -205,7 +200,7 @@ sub rel2abs { if ( ! $self->file_name_is_absolute( $path ) ) { if ( !defined( $base ) || $base eq '' ) { - $base = $self->_cwd(); + $base = Cwd::getcwd(); } elsif ( ! $self->file_name_is_absolute( $base ) ) { $base = $self->rel2abs( $base ) ; diff --git a/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Unix.pm b/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Unix.pm index 9598dbb3621..a1fa6736a1e 100644 --- a/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Unix.pm +++ b/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Unix.pm @@ -1,26 +1,11 @@ package File::Spec::Unix; use strict; -use vars qw($VERSION); +use Cwd (); -$VERSION = '3.63_01'; -my $xs_version = $VERSION; +our $VERSION = '3.74'; $VERSION =~ tr/_//d; -#dont try to load XSLoader and DynaLoader only to ultimately fail on miniperl -if(!defined &canonpath && defined &DynaLoader::boot_DynaLoader) { - eval {#eval is questionable since we are handling potential errors like - #"Cwd object version 3.48 does not match bootstrap parameter 3.50 - #at lib/DynaLoader.pm line 216." by having this eval - if ( $] >= 5.006 ) { - require XSLoader; - XSLoader::load("Cwd", $xs_version); - } else { - require Cwd; - } - }; -} - =head1 NAME File::Spec::Unix - File::Spec for Unix, base for other File::Spec modules @@ -185,7 +170,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) { @@ -409,7 +395,7 @@ Based on code written by Shigio Yamaguchi. sub abs2rel { my($self,$path,$base) = @_; - $base = $self->_cwd() unless defined $base and length $base; + $base = Cwd::getcwd() unless defined $base and length $base; ($path, $base) = map $self->canonpath($_), $path, $base; @@ -436,7 +422,7 @@ sub abs2rel { } } else { - my $wd= ($self->splitpath($self->_cwd(), 1))[1]; + my $wd= ($self->splitpath(Cwd::getcwd(), 1))[1]; $path_directories = $self->catdir($wd, $path); $base_directories = $self->catdir($wd, $base); } @@ -519,7 +505,7 @@ sub rel2abs { if ( ! $self->file_name_is_absolute( $path ) ) { # Figure out the effective $base and clean it up. if ( !defined( $base ) || $base eq '' ) { - $base = $self->_cwd(); + $base = Cwd::getcwd(); } elsif ( ! $self->file_name_is_absolute( $base ) ) { $base = $self->rel2abs( $base ) ; @@ -552,15 +538,6 @@ L<File::Spec> =cut -# Internal routine to File::Spec, no point in making this public since -# it is the standard Cwd interface. Most of the platform-specific -# File::Spec subclasses use this. -sub _cwd { - require Cwd; - Cwd::getcwd(); -} - - # Internal method to reduce xx\..\yy -> yy sub _collapse { my($fs, $path) = @_; diff --git a/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/VMS.pm b/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/VMS.pm index c0cc1e50434..cbafdce88ab 100644 --- a/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/VMS.pm +++ b/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/VMS.pm @@ -1,13 +1,13 @@ package File::Spec::VMS; use strict; -use vars qw(@ISA $VERSION); +use Cwd (); require File::Spec::Unix; -$VERSION = '3.63_01'; +our $VERSION = '3.74'; $VERSION =~ tr/_//d; -@ISA = qw(File::Spec::Unix); +our @ISA = qw(File::Spec::Unix); use File::Basename; use VMS::Filespec; @@ -97,7 +97,7 @@ sub canonpath { # [-.-. ==> [--. # .-.-] ==> .--] # [-.-] ==> [--] - 1 while ($path =~ s/(?<!\^)([\[\.])[^\]\.]+\.-(-+)([\]\.])/$1$2$3/); + 1 while ($path =~ s/(?<!\^)([\[\.])(?:\^.|[^\]\.])+\.-(-+)([\]\.])/$1$2$3/); # That loop does the following # with any amount (minimum 2) # of dashes: @@ -108,11 +108,11 @@ sub canonpath { # # And then, the remaining cases $path =~ s/(?<!\^)\[\.-/[-/; # [.- ==> [- - $path =~ s/(?<!\^)\.[^\]\.]+\.-\./\./g; # .foo.-. ==> . - $path =~ s/(?<!\^)\[[^\]\.]+\.-\./\[/g; # [foo.-. ==> [ - $path =~ s/(?<!\^)\.[^\]\.]+\.-\]/\]/g; # .foo.-] ==> ] + $path =~ s/(?<!\^)\.(?:\^.|[^\]\.])+\.-\./\./g; # .foo.-. ==> . + $path =~ s/(?<!\^)\[(?:\^.|[^\]\.])+\.-\./\[/g; # [foo.-. ==> [ + $path =~ s/(?<!\^)\.(?:\^.|[^\]\.])+\.-\]/\]/g; # .foo.-] ==> ] # [foo.-] ==> [000000] - $path =~ s/(?<!\^)\[[^\]\.]+\.-\]/\[000000\]/g; + $path =~ s/(?<!\^)\[(?:\^.|[^\]\.])+\.-\]/\[000000\]/g; # [] ==> $path =~ s/(?<!\^)\[\]// unless $path eq '[]'; return $unix_rpt ? unixify($path) : $path; @@ -442,7 +442,7 @@ sub abs2rel { my $self = shift; my($path,$base) = @_; - $base = $self->_cwd() unless defined $base and length $base; + $base = Cwd::getcwd() unless defined $base and length $base; # If there is no device or directory syntax on $base, make sure it # is treated as a directory. @@ -514,7 +514,7 @@ sub rel2abs { if ( ! $self->file_name_is_absolute( $path ) ) { # Figure out the effective $base and clean it up. if ( !defined( $base ) || $base eq '' ) { - $base = $self->_cwd; + $base = Cwd::getcwd(); } elsif ( ! $self->file_name_is_absolute( $base ) ) { $base = $self->rel2abs( $base ) ; diff --git a/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Win32.pm b/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Win32.pm index 578d61b37f8..9ccafa7d15f 100644 --- a/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Win32.pm +++ b/gnu/usr.bin/perl/dist/PathTools/lib/File/Spec/Win32.pm @@ -2,13 +2,13 @@ package File::Spec::Win32; use strict; -use vars qw(@ISA $VERSION); +use Cwd (); require File::Spec::Unix; -$VERSION = '3.63_01'; +our $VERSION = '3.74'; $VERSION =~ tr/_//d; -@ISA = qw(File::Spec::Unix); +our @ISA = qw(File::Spec::Unix); # Some regexes we use for path splitting my $DRIVE_RX = '[a-zA-Z]:'; @@ -330,14 +330,13 @@ sub rel2abs { if ($is_abs) { # It's missing a volume, add one - my $vol = ($self->splitpath( $self->_cwd() ))[0]; + my $vol = ($self->splitpath( Cwd::getcwd() ))[0]; return $self->canonpath( $vol . $path ); } if ( !defined( $base ) || $base eq '' ) { - require Cwd ; $base = Cwd::getdcwd( ($self->splitpath( $path ))[0] ) if defined &Cwd::getdcwd ; - $base = $self->_cwd() unless defined $base ; + $base = Cwd::getcwd() unless defined $base ; } elsif ( ! $self->file_name_is_absolute( $base ) ) { $base = $self->rel2abs( $base ) ; |