summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-05-06 15:37:30 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-05-06 15:37:30 +0000
commit605986241de3d828e4de2beec37dc9ecc5aaa260 (patch)
tree4e4c7758c4d45004e25d2c72a576e251302cd58b
parent86d86cadad68b71393e3371f0e467c29982578f9 (diff)
downloadperl-605986241de3d828e4de2beec37dc9ecc5aaa260.tar.gz
Upgrade to PathTools 3.07
p4raw-id: //depot/perl@24407
-rw-r--r--ext/Cwd/Changes25
-rw-r--r--ext/Cwd/t/taint.t5
-rw-r--r--lib/Cwd.pm7
-rw-r--r--lib/File/Spec.pm11
-rw-r--r--lib/File/Spec/Cygwin.pm3
-rw-r--r--lib/File/Spec/Mac.pm3
-rw-r--r--lib/File/Spec/OS2.pm3
-rw-r--r--lib/File/Spec/Unix.pm10
-rw-r--r--lib/File/Spec/VMS.pm3
-rw-r--r--lib/File/Spec/Win32.pm6
-rw-r--r--lib/File/Spec/t/Spec.t1
11 files changed, 59 insertions, 18 deletions
diff --git a/ext/Cwd/Changes b/ext/Cwd/Changes
index 14f3958770..91082438f0 100644
--- a/ext/Cwd/Changes
+++ b/ext/Cwd/Changes
@@ -1,5 +1,30 @@
Revision history for Perl distribution PathTools.
+3.07 Fri May 6 07:46:45 CDT 2005
+
+ - Fixed a bug in which the special perl variable $^O would become
+ tainted under certain versions of perl. [Michael Schwern]
+
+ - File::Spec->rootdir() was returning / on Win32. Now it returns \ .
+ [Michael Schwern]
+
+ - We now avoid modifying @_ in tmpdir() when it's not strictly
+ necessary, which reportedly provides a modest performance
+ boost. [Richard Soderberg]
+
+ - Made a couple of slight changes to the Win32 code so that it works
+ (or works better) on Symbian OS phones. [Jarkko Hietaniemi]
+
+3.06 Wed Apr 13 20:47:26 CDT 2005
+
+ (No changes in functionality)
+
+ - Added a note to the canonpath() docs about why it doesn't collapse
+ foo/../bar sections.
+
+ - The internal-only function bsd_realpath() in the XS file now uses
+ normal arg syntax instead of K&R syntax. [Nicholas Clark]
+
3.05 Mon Feb 28 07:22:58 CST 2005
- Fixed a bug in fast_abs_path() on Win32 in which forward- and
diff --git a/ext/Cwd/t/taint.t b/ext/Cwd/t/taint.t
index 86a92ba3d1..c92dbe3eb1 100644
--- a/ext/Cwd/t/taint.t
+++ b/ext/Cwd/t/taint.t
@@ -14,7 +14,7 @@ chdir 't';
use File::Spec;
use lib File::Spec->catdir('t', 'lib');
-use Test::More tests => 16;
+use Test::More tests => 17;
use Scalar::Util qw/tainted/;
@@ -30,3 +30,6 @@ foreach my $func (@Functions) {
is( $@, '', "$func() should not explode under taint mode" );
ok( tainted($cwd), "its return value should be tainted" );
}
+
+# Previous versions of Cwd tainted $^O
+is !tainted($^O), 1, "\$^O should not be tainted";
diff --git a/lib/Cwd.pm b/lib/Cwd.pm
index 002b7c1183..15525dab42 100644
--- a/lib/Cwd.pm
+++ b/lib/Cwd.pm
@@ -170,7 +170,7 @@ use strict;
use Exporter;
use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION);
-$VERSION = '3.05';
+$VERSION = '3.07';
@ISA = qw/ Exporter /;
@EXPORT = qw(cwd getcwd fastcwd fastgetcwd);
@@ -330,8 +330,9 @@ sub _backtick_pwd {
unless ($METHOD_MAP{$^O}{cwd} or defined &cwd) {
# The pwd command is not available in some chroot(2)'ed environments
my $sep = $Config::Config{path_sep} || ':';
- if( $^O eq 'MacOS' || (defined $ENV{PATH} &&
- $^O ne 'MSWin32' && # no pwd on Windows
+ my $os = $^O; # Protect $^O from tainting
+ if( $os eq 'MacOS' || (defined $ENV{PATH} &&
+ $os ne 'MSWin32' && # no pwd on Windows
grep { -x "$_/pwd" } split($sep, $ENV{PATH})) )
{
*cwd = \&_backtick_pwd;
diff --git a/lib/File/Spec.pm b/lib/File/Spec.pm
index 7cb7192188..0c5c0c02f3 100644
--- a/lib/File/Spec.pm
+++ b/lib/File/Spec.pm
@@ -3,7 +3,7 @@ package File::Spec;
use strict;
use vars qw(@ISA $VERSION);
-$VERSION = '3.05';
+$VERSION = '3.07';
$VERSION = eval $VERSION;
my %module = (MacOS => 'Mac',
@@ -13,7 +13,7 @@ my %module = (MacOS => 'Mac',
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.
+ dos => 'OS2', # Yes, File::Spec::OS2 works on DJGPP.
cygwin => 'Cygwin');
@@ -89,6 +89,13 @@ path.
$cpath = File::Spec->canonpath( $path ) ;
+Note that this does *not* collapse F<x/../y> sections into F<y>. This
+is by design. If F</foo> on your system is a symlink to F</bar/baz>,
+then F</foo/../quux> is actually F</bar/quux>, not F</quux> as a naive
+F<../>-removal would give you. If you want to do this kind of
+processing, you probably want C<Cwd>'s C<realpath()> function to
+actually traverse the filesystem cleaning up paths like this.
+
=item catdir
Concatenate two or more directory names to form a complete path ending
diff --git a/lib/File/Spec/Cygwin.pm b/lib/File/Spec/Cygwin.pm
index e01e03537a..19a2937c6b 100644
--- a/lib/File/Spec/Cygwin.pm
+++ b/lib/File/Spec/Cygwin.pm
@@ -76,8 +76,7 @@ variables are tainted, they are not used.
my $tmpdir;
sub tmpdir {
return $tmpdir if defined $tmpdir;
- my $self = shift;
- $tmpdir = $self->_tmpdir( $ENV{TMPDIR}, "/tmp", 'C:/temp' );
+ $tmpdir = $_[0]->_tmpdir( $ENV{TMPDIR}, "/tmp", 'C:/temp' );
}
=back
diff --git a/lib/File/Spec/Mac.pm b/lib/File/Spec/Mac.pm
index e31737ca71..81016b3090 100644
--- a/lib/File/Spec/Mac.pm
+++ b/lib/File/Spec/Mac.pm
@@ -373,8 +373,7 @@ directory on your startup volume.
my $tmpdir;
sub tmpdir {
return $tmpdir if defined $tmpdir;
- my $self = shift;
- $tmpdir = $self->_tmpdir( $ENV{TMPDIR} );
+ $tmpdir = $_[0]->_tmpdir( $ENV{TMPDIR} );
}
=item updir
diff --git a/lib/File/Spec/OS2.pm b/lib/File/Spec/OS2.pm
index 9f2ca3c5a4..ec308f3b6f 100644
--- a/lib/File/Spec/OS2.pm
+++ b/lib/File/Spec/OS2.pm
@@ -37,8 +37,7 @@ sub _cwd {
my $tmpdir;
sub tmpdir {
return $tmpdir if defined $tmpdir;
- my $self = shift;
- $tmpdir = $self->_tmpdir( @ENV{qw(TMPDIR TEMP TMP)},
+ $tmpdir = $_[0]->_tmpdir( @ENV{qw(TMPDIR TEMP TMP)},
'/tmp',
'/' );
}
diff --git a/lib/File/Spec/Unix.pm b/lib/File/Spec/Unix.pm
index 46158bddd9..47ad797fca 100644
--- a/lib/File/Spec/Unix.pm
+++ b/lib/File/Spec/Unix.pm
@@ -30,6 +30,13 @@ path. On UNIX eliminates successive slashes and successive "/.".
$cpath = File::Spec->canonpath( $path ) ;
+Note that this does *not* collapse F<x/../y> sections into F<y>. This
+is by design. If F</foo> on your system is a symlink to F</bar/baz>,
+then F</foo/../quux> is actually F</bar/quux>, not F</quux> as a naive
+F<../>-removal would give you. If you want to do this kind of
+processing, you probably want C<Cwd>'s C<realpath()> function to
+actually traverse the filesystem cleaning up paths like this.
+
=cut
sub canonpath {
@@ -151,8 +158,7 @@ sub _tmpdir {
sub tmpdir {
return $tmpdir if defined $tmpdir;
- my $self = shift;
- $tmpdir = $self->_tmpdir( $ENV{TMPDIR}, "/tmp" );
+ $tmpdir = $_[0]->_tmpdir( $ENV{TMPDIR}, "/tmp" );
}
=item updir
diff --git a/lib/File/Spec/VMS.pm b/lib/File/Spec/VMS.pm
index e085e0a63d..887746bbe1 100644
--- a/lib/File/Spec/VMS.pm
+++ b/lib/File/Spec/VMS.pm
@@ -297,8 +297,7 @@ is tainted, it is not used.
my $tmpdir;
sub tmpdir {
return $tmpdir if defined $tmpdir;
- my $self = shift;
- $tmpdir = $self->_tmpdir( 'sys$scratch:', $ENV{TMPDIR} );
+ $tmpdir = $_[0]->_tmpdir( 'sys$scratch:', $ENV{TMPDIR} );
}
=item updir (override)
diff --git a/lib/File/Spec/Win32.pm b/lib/File/Spec/Win32.pm
index e5d38102d7..f2b8c391e5 100644
--- a/lib/File/Spec/Win32.pm
+++ b/lib/File/Spec/Win32.pm
@@ -35,6 +35,9 @@ sub devnull {
return "nul";
}
+sub rootdir () { '\\' }
+
+
=item tmpdir
Returns a string representation of the first existing directory
@@ -60,8 +63,7 @@ variables are tainted, they are not used.
my $tmpdir;
sub tmpdir {
return $tmpdir if defined $tmpdir;
- my $self = shift;
- $tmpdir = $self->_tmpdir( @ENV{qw(TMPDIR TEMP TMP)},
+ $tmpdir = $_[0]->_tmpdir( @ENV{qw(TMPDIR TEMP TMP)},
'SYS:/temp',
'C:\system\temp',
'C:/temp',
diff --git a/lib/File/Spec/t/Spec.t b/lib/File/Spec/t/Spec.t
index 565eb8c213..85d580ca96 100644
--- a/lib/File/Spec/t/Spec.t
+++ b/lib/File/Spec/t/Spec.t
@@ -118,6 +118,7 @@ if ($^O eq 'MacOS') {
[ "Unix->rel2abs('/t1','/t1/t2/t3')", '/t1' ],
[ "Win32->case_tolerant()", '1' ],
+[ "Win32->rootdir()", '\\' ],
[ "Win32->splitpath('file')", ',,file' ],
[ "Win32->splitpath('\\d1/d2\\d3/')", ',\\d1/d2\\d3/,' ],