From f6342b4b53f678226f6ef9a63cf476fbf96744f4 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Fri, 17 Jun 2005 09:26:25 +0000 Subject: [PATCH] Upgrade to PathTools 3.09 p4raw-id: //depot/perl@24882 --- ext/Cwd/Changes | 15 +++++++++++++++ ext/Cwd/Cwd.xs | 3 ++- ext/Cwd/t/cwd.t | 9 ++++++++- lib/Cwd.pm | 12 ++++++------ lib/File/Spec.pm | 2 +- 5 files changed, 32 insertions(+), 9 deletions(-) diff --git a/ext/Cwd/Changes b/ext/Cwd/Changes index 867c7b5..0f5d532 100644 --- a/ext/Cwd/Changes +++ b/ext/Cwd/Changes @@ -1,5 +1,20 @@ Revision history for Perl distribution PathTools. +3.09 Tue Jun 14 20:36:50 CDT 2005 + + - Added some block delimiters (brackets) in the Perl_getcwd_sv() XS + function, which were necessary to separate the variable + declarations from the statements when HAS_GETCWD is not + defined. [Yves] + + - Apparently the _NT_cwd() routine is never defined externally like I + thought it was, so I simplified the code around it. + + - When cwd() is implemented using the _backtick_pwd() function, it + sometimes could create accidental undef entries in %ENV under perl + 5.6, because local($hash{key}) is somewhat broken. This is now + fixed with an appropriate workaround. [Neil Watkiss] + 3.08 Sat May 28 10:10:29 CDT 2005 - Fixed a test failure with fast_abs_path() on Windows - it was diff --git a/ext/Cwd/Cwd.xs b/ext/Cwd/Cwd.xs index e7323ab..074e3e3 100644 --- a/ext/Cwd/Cwd.xs +++ b/ext/Cwd/Cwd.xs @@ -268,7 +268,7 @@ int Perl_getcwd_sv(pTHX_ register SV *sv) } #else - + { Stat_t statbuf; int orig_cdev, orig_cino, cdev, cino, odev, oino, tdev, tino; int namelen, pathlen=0; @@ -380,6 +380,7 @@ int Perl_getcwd_sv(pTHX_ register SV *sv) } return TRUE; + } #endif #else diff --git a/ext/Cwd/t/cwd.t b/ext/Cwd/t/cwd.t index 280394b..6058a14 100644 --- a/ext/Cwd/t/cwd.t +++ b/ext/Cwd/t/cwd.t @@ -18,7 +18,7 @@ use lib File::Spec->catdir('t', 'lib'); use Test::More; require VMS::Filespec if $^O eq 'VMS'; -my $tests = 28; +my $tests = 29; # _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'; @@ -39,6 +39,13 @@ ok( !defined(&chdir), 'chdir() not exported by default' ); ok( !defined(&abs_path), ' nor abs_path()' ); ok( !defined(&fast_abs_path), ' nor fast_abs_path()'); +{ + my @fields = qw(PATH IFS CDPATH ENV BASH_ENV); + my $before = grep exists $ENV{$_}, @fields; + cwd(); + my $after = grep exists $ENV{$_}, @fields; + is($before, $after, "cwd() shouldn't create spurious entries in %ENV"); +} # XXX force Cwd to bootsrap its XSUBs since we have set @INC = "../lib" # XXX and subsequent chdir()s can make them impossible to find diff --git a/lib/Cwd.pm b/lib/Cwd.pm index d00c8fe..18f4b65 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.08'; +$VERSION = '3.09'; @ISA = qw/ Exporter /; @EXPORT = qw(cwd getcwd fastcwd fastgetcwd); @@ -315,7 +315,10 @@ sub _croak { require Carp; Carp::croak(@_) } # The 'natural and safe form' for UNIX (pwd may be setuid root) sub _backtick_pwd { - local @ENV{qw(PATH IFS CDPATH ENV BASH_ENV)}; + # Localize %ENV entries in a way that won't create new hash keys + my @localize = grep exists $ENV{$_}, qw(PATH IFS CDPATH ENV BASH_ENV); + local @ENV{@localize}; + my $cwd = `$pwd_cmd`; # Belt-and-suspenders in case someone said "undef $/". local $/ = "\n"; @@ -642,10 +645,7 @@ sub _win32_cwd { return $ENV{'PWD'}; } -*_NT_cwd = \&_win32_cwd if (!defined &_NT_cwd && - defined &Win32::GetCwd); - -*_NT_cwd = \&_os2_cwd unless defined &_NT_cwd; +*_NT_cwd = defined &Win32::GetCwd ? \&_win32_cwd : \&_os2_cwd; sub _dos_cwd { if (!defined &Dos::GetCwd) { diff --git a/lib/File/Spec.pm b/lib/File/Spec.pm index 985ff7b..89d7e45 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.08'; +$VERSION = '3.09'; $VERSION = eval $VERSION; my %module = (MacOS => 'Mac', -- 2.7.4