Subject: | [PATCH] 1.45 busted on VMS |
1.45 doesn't work on VMS. The issue is inside _can_write_dir().
splitdir() on VMS with File::Spec 3.01 isn't returning '' as the first
directory, indicating an absolute path. This results in catdir and
catpath putting together a relative directory. As a result, it thinks
[.blib.lib.auto] cannot be made because it's trying to make
volume:[.path.to.cwd.blib.lib.auto]. Note: [.foo] is relative.
I don't see the need to force every path to be absolute. The parent
directories obviously exist and bear no impact on whether a relative
directory is writable. Eliminating rel2abs() removes the bulk of the
problem, since EUI is usually asked to make relative paths. The problem
will still exist for absolute paths.
Patch attached.
Subject: | vms.patch |
--- MANIFEST (revision 54637)
+++ MANIFEST (local)
@@ -1,14 +1,16 @@
Build.PL
Changes
+INSTALL.SKIP
lib/ExtUtils/Install.pm
lib/ExtUtils/Installed.pm
lib/ExtUtils/Packlist.pm
Makefile.PL
MANIFEST
MANIFEST.SKIP
-INSTALL.SKIP
+META.yml
README
t/basic.t
+t/can_write_dir.t
t/Install.t
t/Installed.t
t/lib/MakeMaker/Test/Setup/BFD.pm
@@ -21,4 +23,3 @@
t/Packlist.t
t/pod-coverage.t
t/pod.t
-META.yml
--- Makefile.PL (revision 54637)
+++ Makefile.PL (local)
@@ -1,4 +1,4 @@
-use 5.00503;
+BEGIN { require 5.006; }
use strict;
use lib qw(lib); # use ourself if possible not the existing stuff.
--- lib/ExtUtils/Install.pm (revision 54637)
+++ lib/ExtUtils/Install.pm (local)
@@ -431,8 +431,11 @@
return
unless defined $dir and length $dir;
- my ($vol, $dirs, $file) = File::Spec->splitpath(File::Spec->rel2abs($dir),1);
+ my ($vol, $dirs, $file) = File::Spec->splitpath($dir,1);
my @dirs = File::Spec->splitdir($dirs);
+ unshift @dirs, File::Spec->curdir
+ unless File::Spec->file_name_is_absolute($dir);
+
my $path='';
my @make;
while (@dirs) {
--- t/can_write_dir.t (revision 54637)
+++ t/can_write_dir.t (local)
@@ -0,0 +1,55 @@
+#!/usr/bin/perl -w
+
+# Test the private _can_write_dir() function.
+
+use strict;
+use ExtUtils::Install;
+use File::Spec;
+{ package FS; our @ISA = qw(File::Spec); }
+
+# Alias it for easier access
+*can_write_dir = \&ExtUtils::Install::_can_write_dir;
+
+use Test::More 'no_plan';
+
+
+my $dne = FS->catdir(qw(does not exist));
+ok ! -e $dne;
+is_deeply [can_write_dir($dne)],
+ [1,
+ FS->curdir,
+ FS->catdir('does'),
+ FS->catdir('does', 'not'),
+ FS->catdir('does', 'not', 'exist')
+ ];
+
+
+my $abs_dne = FS->rel2abs($dne);
+ok ! -e $abs_dne;
+is_deeply [can_write_dir($abs_dne)],
+ [1,
+ FS->rel2abs(FS->curdir),
+ FS->rel2abs(FS->catdir('does')),
+ FS->rel2abs(FS->catdir('does', 'not')),
+ FS->rel2abs(FS->catdir('does', 'not', 'exist')),
+ ];
+
+
+my $exists = FS->catdir(qw(exists));
+my $subdir = FS->catdir(qw(exists subdir));
+ok mkdir $exists;
+END { rmdir $exists }
+
+ok chmod 0555, $exists, 'make read only';
+ok !-w $exists;
+is_deeply [can_write_dir($exists)], [0, $exists];
+is_deeply [can_write_dir($subdir)], [0, $exists, $subdir];
+
+ok chmod 0777, $exists, 'make writable';
+ok -w $exists;
+is_deeply [can_write_dir($exists)], [1, $exists];
+is_deeply [can_write_dir($subdir)],
+ [1,
+ $exists,
+ $subdir
+ ];