=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
If present, will cause C<rmtree> 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<rmtree> 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
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<skip_others> parameter is set (or the
+Additionally, unless the C<safe> parameter is set (or the
third parameter in the traditional interface is TRUE), should a
C<rmtree> be interrupted, files that were originally in read-only
mode may now have their permissions set to a read-write (or "delete
use Exporter ();
use vars qw($VERSION @ISA @EXPORT);
-$VERSION = '2.00_11';
+$VERSION = '2.01';
@ISA = qw(Exporter);
@EXPORT = qw(mkpath rmtree);
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) {
$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");
$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
$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)");
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");