From: Rafael Garcia-Suarez Date: Fri, 6 May 2005 15:37:30 +0000 (+0000) Subject: Upgrade to PathTools 3.07 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=605986241de3d828e4de2beec37dc9ecc5aaa260;p=p5sagit%2Fp5-mst-13.2.git Upgrade to PathTools 3.07 p4raw-id: //depot/perl@24407 --- diff --git a/ext/Cwd/Changes b/ext/Cwd/Changes index 14f3958..9108243 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 86a92ba..c92dbe3 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 002b7c1..15525da 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 7cb7192..0c5c0c0 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 sections into F. This +is by design. If F on your system is a symlink to F, +then F is actually F, not F as a naive +F<../>-removal would give you. If you want to do this kind of +processing, you probably want C's C 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 e01e035..19a2937 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 e31737c..81016b3 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 9f2ca3c..ec308f3 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 46158bd..47ad797 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 sections into F. This +is by design. If F on your system is a symlink to F, +then F is actually F, not F as a naive +F<../>-removal would give you. If you want to do this kind of +processing, you probably want C's C 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 e085e0a..887746b 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 e5d3810..f2b8c39 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 565eb8c..85d580c 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/,' ],