From: David Landgren Date: Sun, 30 Sep 2007 15:19:49 +0000 (+0200) Subject: bring File::Path up to 2.01 (was: Re: Freeze ?) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5808899ac07d66fe4ab68c336e611c275c835a51;p=p5sagit%2Fp5-mst-13.2.git bring File::Path up to 2.01 (was: Re: Freeze ?) Message-ID: <46FFA275.6010304@landgren.net> p4raw-id: //depot/perl@31997 --- diff --git a/lib/File/Path.pm b/lib/File/Path.pm index bd54bbc..156e743 100644 --- a/lib/File/Path.pm +++ b/lib/File/Path.pm @@ -6,8 +6,8 @@ File::Path - Create or remove directory trees =head1 VERSION -This document describes version 2.00_12 of File::Path, released -2007-09-17. +This document describes version 2.01 of File::Path, released +2007-09-29. =head1 SYNOPSIS @@ -93,11 +93,14 @@ in an C block. If present, will cause C to print the name of each file as it is unlinked. By default nothing is printed. -=item skip_others +=item safe When set to a true value, will cause C to skip the files for which the process lacks the required privileges needed to delete -files, such as delete privileges on VMS. +files, such as delete privileges on VMS. In other words, the code +will make no attempt to alter file permissions. Thus, if the process +is interrupted, no filesystem object will be left in a more +permissive mode. =item keep_root @@ -316,7 +319,7 @@ See the following pages for more information: http://www.nntp.perl.org/group/perl.perl5.porters/2005/01/msg97623.html http://www.debian.org/security/2005/dsa-696 -Additionally, unless the C parameter is set (or the +Additionally, unless the C parameter is set (or the third parameter in the traditional interface is TRUE), should a C be interrupted, files that were originally in read-only mode may now have their permissions set to a read-write (or "delete @@ -522,7 +525,7 @@ BEGIN { use Exporter (); use vars qw($VERSION @ISA @EXPORT); -$VERSION = '2.00_11'; +$VERSION = '2.01'; @ISA = qw(Exporter); @EXPORT = qw(mkpath rmtree); diff --git a/lib/File/Path.t b/lib/File/Path.t index 1e007e8..646d5cb 100755 --- a/lib/File/Path.t +++ b/lib/File/Path.t @@ -12,6 +12,8 @@ BEGIN { eval "use Test::Output"; my $has_Test_Output = $@ ? 0 : 1; +my $Is_VMS = $^O eq 'VMS'; + # first check for stupid permissions second for full, so we clean up # behind ourselves for my $perm (0111,0777) { @@ -82,7 +84,7 @@ is(scalar(@created), 0, "skipped making existing directories (old style 1)") $dir = catdir($tmp_base,'C'); # mkpath returns unix syntax filespecs on VMS -$dir = VMS::Filespec::unixify($dir) if $^O eq 'VMS'; +$dir = VMS::Filespec::unixify($dir) if $Is_VMS; @created = mkpath($tmp_base, $dir); is(scalar(@created), 1, "created directory (new style 1)"); is($created[0], $dir, "created directory (new style 1) cross-check"); @@ -93,16 +95,17 @@ is(scalar(@created), 0, "skipped making existing directories (old style 2)") $dir2 = catdir($tmp_base,'D'); # mkpath returns unix syntax filespecs on VMS -$dir2 = VMS::Filespec::unixify($dir2) if $^O eq 'VMS'; +$dir2 = VMS::Filespec::unixify($dir2) if $Is_VMS; @created = mkpath($tmp_base, $dir, $dir2); is(scalar(@created), 1, "created directory (new style 2)"); is($created[0], $dir2, "created directory (new style 2) cross-check"); $count = rmtree($dir, 0); -is($count, 1, "removed directory (old style 1)"); +is($count, 1, "removed directory unsafe mode"); $count = rmtree($dir2, 0, 1); -is($count, 1, "removed directory (old style 2)"); +my $removed = $Is_VMS ? 0 : 1; +is($count, $removed, "removed directory safe mode"); # mkdir foo ./E/../Y # Y should exist @@ -137,7 +140,7 @@ ok(-d $dir2, "dir z still exists"); $dir = catdir($tmp_base,'F'); # mkpath returns unix syntax filespecs on VMS -$dir = VMS::Filespec::unixify($dir) if $^O eq 'VMS'; +$dir = VMS::Filespec::unixify($dir) if $Is_VMS; @created = mkpath($dir, undef, 0770); is(scalar(@created), 1, "created directory (old style 2 verbose undef)"); @@ -155,7 +158,7 @@ is($created[0], $dir, "created directory (old style 3 mode undef) cross-check"); is(rmtree($dir, 0, undef), 1, "removed directory 3 verbose undef"); $dir = catdir($tmp_base,'G'); -$dir = VMS::Filespec::unixify($dir) if $^O eq 'VMS'; +$dir = VMS::Filespec::unixify($dir) if $Is_VMS; @created = mkpath($dir, undef, 0200); is(scalar(@created), 1, "created write-only dir");