On 9/10/07, David Landgren <[EMAIL PROTECTED]> wrote:
> Craig A. Berry wrote:
> > On 9/8/07, Rafael Garcia-Suarez <[EMAIL PROTECTED]> wrote:
> >> On 08/09/2007, David Landgren <[EMAIL PROTECTED]> wrote:
> >>> The following patch to Path.pm and Path.t allows blead's test suite to
> >>> run without errors.
> >> Thanks, applied as #31819.
> >
> > The number of test failures in blead on VMS went from about 20 to
> > about 40 after this, mostly in CPANPLUS and Module::Build, which make
> > heavy use of rmtree.  I'm working on it, but not done yet.
>
> Odd. They just does rmtree($dir) with nothing fancy. Keep me posted: I
> have a couple of spelling POD fixups a sub-optimal code thing to fix up
> as well, so I'll hold off sending them fro the time being.
>
> If you could send me the changes rather than to blead then only one
> change would need to be made. But if not, no matter.

Sorry, I just saw this after checking in #31843, which I also attach
here.  Here was my changelog description:

        VMS help for File::Path 2.00_11:  chdir() is finicky about directory
        format; catdir spews warnings when given files that aren't directories;
        File::Spec functions may call stat(), thus zapping C<_>; filenames with
        characters that need escaping (such as spaces), must have some path
        syntax attached to them and be converted to native syntax in order to
        force escaping to take place.

I'm not happy about adding more special-case code, but I couldn't see
any other way around these problems.  The effect on non-VMS platforms
should be negligible: I moved an lstat() down a few lines and replaced
a catdir with a catfile where what's being passed to it could be
either directories or a directory and a file.
--- lib/File/Path.pm;-0 Sat Sep  8 15:48:35 2007
+++ lib/File/Path.pm    Mon Sep 10 01:16:04 2007
@@ -522,7 +522,7 @@ BEGIN {
 
 use Exporter ();
 use vars qw($VERSION @ISA @EXPORT);
-$VERSION = '2.00_11';
+$VERSION = '2.00_12';
 @ISA     = qw(Exporter);
 @EXPORT  = qw(mkpath rmtree);
 
@@ -708,7 +708,6 @@ sub _rmtree {
         else {
             $root =~ s{/\z}{};
        }
-        my ($ldev, $lino, $perm) = (lstat $root)[0,1,2] or next;
 
         # since we chdir into each directory, it may not be obvious
         # to figure out where we are if we generate a message about
@@ -717,11 +716,14 @@ sub _rmtree {
         # opposed to being truly canonical, anchored from the root (/).
 
         my $canon = $arg->{prefix}
-            ? File::Spec->catdir($arg->{prefix}, $root)
+            ? File::Spec->catfile($arg->{prefix}, $root)
             : $root
         ;
 
+        my ($ldev, $lino, $perm) = (lstat $root)[0,1,2] or next;
+
        if ( -d _ ) {
+            $root = VMS::Filespec::pathify($root) if $Is_VMS;
             if (!chdir($root)) {
                 # see if we can escalate privileges to get in
                 # (e.g. funny protection mask such as -w- instead of rwx)
@@ -840,6 +842,10 @@ sub _rmtree {
         }
         else {
             # not a directory
+
+            $root = VMS::Filespec::vmsify("./$root")
+                if $Is_VMS && !File::Spec->file_name_is_absolute($root);
+
             if ($arg->{safe} &&
                ($Is_VMS ? !&VMS::Filespec::candelete($root)
                         : !(-l $root || -w $root)))

Reply via email to