summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/dist/Cwd
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2013-03-25 20:09:38 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2013-03-25 20:09:38 +0000
commit39cf45909bf0404f27de64c367d8dcdf37147915 (patch)
tree70cd1ac1a81c3cb8fa62c79486459e5d00dabf46 /gnu/usr.bin/perl/dist/Cwd
parent38b9480a88793314fc621bfec3da592ab7cc1b67 (diff)
import perl 5.16.3 from CPAN - worked on by Andrew Fresh and myself
Diffstat (limited to 'gnu/usr.bin/perl/dist/Cwd')
-rw-r--r--gnu/usr.bin/perl/dist/Cwd/Cwd.pm6
-rw-r--r--gnu/usr.bin/perl/dist/Cwd/Cwd.xs2
-rw-r--r--gnu/usr.bin/perl/dist/Cwd/lib/File/Spec.pm4
-rw-r--r--gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Cygwin.pm2
-rw-r--r--gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Epoc.pm2
-rw-r--r--gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Functions.pm2
-rw-r--r--gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Mac.pm2
-rw-r--r--gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/OS2.pm2
-rw-r--r--gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Unix.pm76
-rw-r--r--gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/VMS.pm2
-rw-r--r--gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Win32.pm2
-rw-r--r--gnu/usr.bin/perl/dist/Cwd/t/Spec.t4
-rw-r--r--gnu/usr.bin/perl/dist/Cwd/t/cwd.t12
-rw-r--r--gnu/usr.bin/perl/dist/Cwd/t/taint.t9
14 files changed, 39 insertions, 88 deletions
diff --git a/gnu/usr.bin/perl/dist/Cwd/Cwd.pm b/gnu/usr.bin/perl/dist/Cwd/Cwd.pm
index 8886c67b4c5..a48d20547f8 100644
--- a/gnu/usr.bin/perl/dist/Cwd/Cwd.pm
+++ b/gnu/usr.bin/perl/dist/Cwd/Cwd.pm
@@ -171,7 +171,7 @@ use strict;
use Exporter;
use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION);
-$VERSION = '3.40';
+$VERSION = '3.39_02';
my $xs_version = $VERSION;
$VERSION =~ tr/_//;
@@ -624,8 +624,8 @@ sub fast_abs_path {
# Detaint else we'll explode in taint mode. This is safe because
# we're not doing anything dangerous with it.
- ($path) = $path =~ /(.*)/s;
- ($cwd) = $cwd =~ /(.*)/s;
+ ($path) = $path =~ /(.*)/;
+ ($cwd) = $cwd =~ /(.*)/;
unless (-e $path) {
_croak("$path: No such file or directory");
diff --git a/gnu/usr.bin/perl/dist/Cwd/Cwd.xs b/gnu/usr.bin/perl/dist/Cwd/Cwd.xs
index 3940006e626..539311662c5 100644
--- a/gnu/usr.bin/perl/dist/Cwd/Cwd.xs
+++ b/gnu/usr.bin/perl/dist/Cwd/Cwd.xs
@@ -247,7 +247,7 @@ return FALSE
#ifndef getcwd_sv
/* Taken from perl 5.8's util.c */
#define getcwd_sv(a) Perl_getcwd_sv(aTHX_ a)
-int Perl_getcwd_sv(pTHX_ SV *sv)
+int Perl_getcwd_sv(pTHX_ register SV *sv)
{
#ifndef PERL_MICRO
diff --git a/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec.pm b/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec.pm
index 6062c015179..782e28425b7 100644
--- a/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec.pm
+++ b/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec.pm
@@ -3,7 +3,7 @@ package File::Spec;
use strict;
use vars qw(@ISA $VERSION);
-$VERSION = '3.40';
+$VERSION = '3.39_02';
$VERSION =~ tr/_//;
my %module = (MacOS => 'Mac',
@@ -331,7 +331,7 @@ splitpath(), splitdir(), catpath() and catdir() by Barrie Slaymaker.
=head1 COPYRIGHT
-Copyright (c) 2004-2013 by the Perl 5 Porters. All rights reserved.
+Copyright (c) 2004-2010 by the Perl 5 Porters. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
diff --git a/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Cygwin.pm b/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Cygwin.pm
index b27f7b15f19..b63b85f6cda 100644
--- a/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Cygwin.pm
+++ b/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Cygwin.pm
@@ -4,7 +4,7 @@ use strict;
use vars qw(@ISA $VERSION);
require File::Spec::Unix;
-$VERSION = '3.40';
+$VERSION = '3.39_02';
$VERSION =~ tr/_//;
@ISA = qw(File::Spec::Unix);
diff --git a/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Epoc.pm b/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Epoc.pm
index e7faa16086a..50304ffed06 100644
--- a/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Epoc.pm
+++ b/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Epoc.pm
@@ -3,7 +3,7 @@ package File::Spec::Epoc;
use strict;
use vars qw($VERSION @ISA);
-$VERSION = '3.40';
+$VERSION = '3.39_02';
$VERSION =~ tr/_//;
require File::Spec::Unix;
diff --git a/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Functions.pm b/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Functions.pm
index f5b9046aa5e..454a5b30898 100644
--- a/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Functions.pm
+++ b/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Functions.pm
@@ -5,7 +5,7 @@ use strict;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION);
-$VERSION = '3.40';
+$VERSION = '3.39_02';
$VERSION =~ tr/_//;
require Exporter;
diff --git a/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Mac.pm b/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Mac.pm
index 7f42171bc92..57d1d3efb33 100644
--- a/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Mac.pm
+++ b/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Mac.pm
@@ -4,7 +4,7 @@ use strict;
use vars qw(@ISA $VERSION);
require File::Spec::Unix;
-$VERSION = '3.40';
+$VERSION = '3.39_02';
$VERSION =~ tr/_//;
@ISA = qw(File::Spec::Unix);
diff --git a/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/OS2.pm b/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/OS2.pm
index 7f60d68927a..5461cf7a701 100644
--- a/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/OS2.pm
+++ b/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/OS2.pm
@@ -4,7 +4,7 @@ use strict;
use vars qw(@ISA $VERSION);
require File::Spec::Unix;
-$VERSION = '3.40';
+$VERSION = '3.39_02';
$VERSION =~ tr/_//;
@ISA = qw(File::Spec::Unix);
diff --git a/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Unix.pm b/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Unix.pm
index a1a91b42607..c150445d776 100644
--- a/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Unix.pm
+++ b/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Unix.pm
@@ -3,7 +3,7 @@ package File::Spec::Unix;
use strict;
use vars qw($VERSION);
-$VERSION = '3.40';
+$VERSION = '3.39_02';
$VERSION =~ tr/_//;
=head1 NAME
@@ -352,11 +352,9 @@ directories.
If $path is relative, it is converted to absolute form using L</rel2abs()>.
This means that it is taken to be relative to L<cwd()|Cwd>.
-No checks against the filesystem are made, so the result may not be correct if
-C<$base> contains symbolic links. (Apply
-L<Cwd::abs_path()|Cwd/abs_path> beforehand if that
-is a concern.) On VMS, there is interaction with the working environment, as
-logicals and macros are expanded.
+No checks against the filesystem are made. On VMS, there is
+interaction with the working environment, as logicals and
+macros are expanded.
Based on code written by Shigio Yamaguchi.
@@ -368,32 +366,28 @@ sub abs2rel {
($path, $base) = map $self->canonpath($_), $path, $base;
- my $path_directories;
- my $base_directories;
-
if (grep $self->file_name_is_absolute($_), $path, $base) {
($path, $base) = map $self->rel2abs($_), $path, $base;
+ }
+ else {
+ # save a couple of cwd()s if both paths are relative
+ ($path, $base) = map $self->catdir('/', $_), $path, $base;
+ }
- my ($path_volume) = $self->splitpath($path, 1);
- my ($base_volume) = $self->splitpath($base, 1);
+ my ($path_volume) = $self->splitpath($path, 1);
+ my ($base_volume) = $self->splitpath($base, 1);
- # Can't relativize across volumes
- return $path unless $path_volume eq $base_volume;
+ # Can't relativize across volumes
+ return $path unless $path_volume eq $base_volume;
- $path_directories = ($self->splitpath($path, 1))[1];
- $base_directories = ($self->splitpath($base, 1))[1];
+ my $path_directories = ($self->splitpath($path, 1))[1];
+ my $base_directories = ($self->splitpath($base, 1))[1];
- # For UNC paths, the user might give a volume like //foo/bar that
- # strictly speaking has no directory portion. Treat it as if it
- # had the root directory for that volume.
- if (!length($base_directories) and $self->file_name_is_absolute($base)) {
- $base_directories = $self->rootdir;
- }
- }
- else {
- my $wd= ($self->splitpath($self->_cwd(), 1))[1];
- $path_directories = $self->catdir($wd, $path);
- $base_directories = $self->catdir($wd, $base);
+ # For UNC paths, the user might give a volume like //foo/bar that
+ # strictly speaking has no directory portion. Treat it as if it
+ # had the root directory for that volume.
+ if (!length($base_directories) and $self->file_name_is_absolute($base)) {
+ $base_directories = $self->rootdir;
}
# Now, remove all leading components that are the same
@@ -401,39 +395,19 @@ sub abs2rel {
my @basechunks = $self->splitdir( $base_directories );
if ($base_directories eq $self->rootdir) {
- return $self->curdir if $path_directories eq $self->rootdir;
shift @pathchunks;
return $self->canonpath( $self->catpath('', $self->catdir( @pathchunks ), '') );
}
- my @common;
while (@pathchunks && @basechunks && $self->_same($pathchunks[0], $basechunks[0])) {
- push @common, shift @pathchunks ;
+ shift @pathchunks ;
shift @basechunks ;
}
return $self->curdir unless @pathchunks || @basechunks;
- # @basechunks now contains the directories the resulting relative path
- # must ascend out of before it can descend to $path_directory. If there
- # are updir components, we must descend into the corresponding directories
- # (this only works if they are no symlinks).
- my @reverse_base;
- while( defined(my $dir= shift @basechunks) ) {
- if( $dir ne $self->updir ) {
- unshift @reverse_base, $self->updir;
- push @common, $dir;
- }
- elsif( @common ) {
- if( @reverse_base && $reverse_base[0] eq $self->updir ) {
- shift @reverse_base;
- pop @common;
- }
- else {
- unshift @reverse_base, pop @common;
- }
- }
- }
- my $result_dirs = $self->catdir( @reverse_base, @pathchunks );
+ # $base now contains the directories the resulting relative path
+ # must ascend out of before it can descend to $path_directory.
+ my $result_dirs = $self->catdir( ($self->updir) x @basechunks, @pathchunks );
return $self->canonpath( $self->catpath('', $result_dirs, '') );
}
@@ -499,8 +473,6 @@ Copyright (c) 2004 by the Perl 5 Porters. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
-Please submit bug reports and patches to perlbug@perl.org.
-
=head1 SEE ALSO
L<File::Spec>
diff --git a/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/VMS.pm b/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/VMS.pm
index 6af1ac0b3d1..1ababbf1350 100644
--- a/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/VMS.pm
+++ b/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/VMS.pm
@@ -4,7 +4,7 @@ use strict;
use vars qw(@ISA $VERSION);
require File::Spec::Unix;
-$VERSION = '3.40';
+$VERSION = '3.39_02';
$VERSION =~ tr/_//;
@ISA = qw(File::Spec::Unix);
diff --git a/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Win32.pm b/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Win32.pm
index ae74a265931..39f5a8bb95a 100644
--- a/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Win32.pm
+++ b/gnu/usr.bin/perl/dist/Cwd/lib/File/Spec/Win32.pm
@@ -5,7 +5,7 @@ use strict;
use vars qw(@ISA $VERSION);
require File::Spec::Unix;
-$VERSION = '3.40';
+$VERSION = '3.39_02';
$VERSION =~ tr/_//;
@ISA = qw(File::Spec::Unix);
diff --git a/gnu/usr.bin/perl/dist/Cwd/t/Spec.t b/gnu/usr.bin/perl/dist/Cwd/t/Spec.t
index de6d23792d7..be3139cd1e1 100644
--- a/gnu/usr.bin/perl/dist/Cwd/t/Spec.t
+++ b/gnu/usr.bin/perl/dist/Cwd/t/Spec.t
@@ -120,10 +120,6 @@ my @tests = (
[ "Unix->abs2rel('/t1/t2/t3', '/t1')", 't2/t3' ],
[ "Unix->abs2rel('t1/t2/t3', 't1')", 't2/t3' ],
[ "Unix->abs2rel('t1/t2/t3', 't4')", '../t1/t2/t3' ],
- [ "Unix->abs2rel('.', '.')", '.' ],
- [ "Unix->abs2rel('/', '/')", '.' ],
- [ "Unix->abs2rel('../t1', 't2/t3')", '../../../t1' ],
- [ "Unix->abs2rel('t1', 't2/../t3')", '../t1' ],
[ "Unix->rel2abs('t4','/t1/t2/t3')", '/t1/t2/t3/t4' ],
[ "Unix->rel2abs('t4/t5','/t1/t2/t3')", '/t1/t2/t3/t4/t5' ],
diff --git a/gnu/usr.bin/perl/dist/Cwd/t/cwd.t b/gnu/usr.bin/perl/dist/Cwd/t/cwd.t
index f7b03ed4fc6..c9a218725b9 100644
--- a/gnu/usr.bin/perl/dist/Cwd/t/cwd.t
+++ b/gnu/usr.bin/perl/dist/Cwd/t/cwd.t
@@ -36,7 +36,7 @@ if ($IsVMS) {
$vms_mode = 0 if ($vms_unix_rpt);
}
-my $tests = 31;
+my $tests = 30;
# _perl_abs_path() currently only works when the directory separator
# is '/', so don't test it when it won't work.
my $EXTRA_ABSPATH_TESTS = ($Config{prefix} =~ m/\//) && $^O ne 'cygwin';
@@ -245,16 +245,6 @@ SKIP: {
if $EXTRA_ABSPATH_TESTS;
}
-SKIP: {
- my $dir = "${$}a\nx";
- mkdir $dir or skip "OS does not support dir names containing LF";
- chdir $dir or skip "OS cannot chdir into LF";
- eval { Cwd::fast_abs_path() };
- is $@, "", 'fast_abs_path does not die in dir whose name contains LF';
- chdir File::Spec->updir;
- rmdir $dir;
-}
-
#############################################
# These routines give us sort of a poor-man's cross-platform
diff --git a/gnu/usr.bin/perl/dist/Cwd/t/taint.t b/gnu/usr.bin/perl/dist/Cwd/t/taint.t
index 309b3e5dfcb..60cbfebc413 100644
--- a/gnu/usr.bin/perl/dist/Cwd/t/taint.t
+++ b/gnu/usr.bin/perl/dist/Cwd/t/taint.t
@@ -8,14 +8,7 @@ chdir 't' unless $ENV{PERL_CORE};
use File::Spec;
use lib File::Spec->catdir('t', 'lib');
-use Test::More;
-BEGIN {
- plan(
- ${^TAINT}
- ? (tests => 17)
- : (skip_all => "A perl without taint support")
- );
-}
+use Test::More tests => 17;
use Scalar::Util qw/tainted/;