Discussion:
Change 31726: [patch@31706]01_module_load_conditional.t fix for VMS
(too old to reply)
Craig A . Berry
2007-08-16 17:15:02 UTC
Permalink
Change 31726 by ***@craigb-brianor on 2007/08/16 17:05:48

Subject: [***@31706]01_module_load_conditional.t fix for VMS
From: "John E. Malmberg" <***@qsl.net>
Date: Thu, 16 Aug 2007 00:27:35 -0500
Message-id: <***@qsl.net>

Affected files ...

... //depot/perl/lib/Module/Load/Conditional/t/01_Module_Load_Conditional.t#5 edit

Differences ...

==== //depot/perl/lib/Module/Load/Conditional/t/01_Module_Load_Conditional.t#5 (text) ====
Index: perl/lib/Module/Load/Conditional/t/01_Module_Load_Conditional.t
--- perl/lib/Module/Load/Conditional/t/01_Module_Load_Conditional.t#4~29989~ 2007-01-26 00:27:23.000000000 -0800
+++ perl/lib/Module/Load/Conditional/t/01_Module_Load_Conditional.t 2007-08-16 10:05:48.000000000 -0700
@@ -43,8 +43,24 @@
ok( $rv->{version} == $Module::Load::Conditional::VERSION,
q[ Found proper version] );

+ # This test is expecting the file to in UNIX format, so force
+ $rv->{file} = VMS::Filespec::unixify($rv->{file}) if $^O eq 'VMS';
+
+ # break up the specification
+ my @rv_path;
+ if ($^O eq 'VMS') {
+ # Use the UNIX specific method, as the VMS one currently
+ # converts the file spec back to VMS format.
+ @rv_path = File::Spec::Unix->splitpath($rv->{file});
+ } else {
+ @rv_path = File::Spec->splitpath($rv->{file});
+ }
+
+ # First element could be blank for some system types like VMS
+ shift @rv_path if $rv_path[0] eq '';
+
ok( $INC{'Module/Load/Conditional.pm'} eq
- File::Spec::Unix->catfile(File::Spec->splitdir($rv->{file}) ),
+ File::Spec::Unix->catfile(@rv_path),
q[ Found proper file]
);

@@ -152,6 +168,7 @@
{ package A::B::C::D;
$A::B::C::D::VERSION = $$;
$INC{'A/B/C/D.pm'} = $$.$$;
+ $INC{'[.A.B.C]D.pm'} = $$.$$ if $^O eq 'VMS';
}

my $href = check_install( module => 'A::B::C::D', version => 0 );
@@ -164,4 +181,3 @@
' can_load successful' );
}

-
End of Patch.
Steve Hay
2007-08-17 10:55:58 UTC
Permalink
for VMS
Post by Craig A . Berry
Date: Thu, 16 Aug 2007 00:27:35 -0500
This breaks on Win32. File::Spec->splitpath() returns three items, which
don't necessarily have the correct flavour of slash (backslash or
forward slash) on Win32:

$INC{'Module/Load/Conditional.pm'}='../../../../Module/Load/Conditional.
pm'
@rv_path = ('', '..\..\..\..\Module\Load\', 'Conditional.pm')
File::Spec::Unix->catfile(@rv_path)='..\..\..\..\Module\Load\/Conditiona
l.pm'

I've therefore put a splitdir() call back into the test to break down
that list of directories, so that they can all get joined back together
in Unix style (change #31727). Hope it's still OK on VMS!
John E. Malmberg
2007-08-20 14:31:46 UTC
Permalink
Post by Craig A . Berry
for VMS
Post by Craig A . Berry
Date: Thu, 16 Aug 2007 00:27:35 -0500
This breaks on Win32. File::Spec->splitpath() returns three items, which
don't necessarily have the correct flavour of slash (backslash or
$INC{'Module/Load/Conditional.pm'}='../../../../Module/Load/Conditional.
pm'
@rv_path = ('', '..\..\..\..\Module\Load\', 'Conditional.pm')
l.pm'
I've therefore put a splitdir() call back into the test to break down
that list of directories, so that they can all get joined back together
in Unix style (change #31727). Hope it's still OK on VMS!
Splitdir can only be portably used on path specifications that only
contain directories. $rv-{file} contains a file specification, and so
does the resulting @rv_path.

This patch breaks VMS again. I will not have time to submit a fix until
later, as I had a 2 second power failure this morning just when I
started to look at this.

-John
***@qsl.net
Personal Opinion Only
Steve Hay
2007-08-20 15:06:43 UTC
Permalink
Post by John E. Malmberg
Post by Craig A . Berry
for VMS
Post by Craig A . Berry
Date: Thu, 16 Aug 2007 00:27:35 -0500
This breaks on Win32. File::Spec->splitpath() returns three items,
which don't necessarily have the correct flavour of slash (backslash
$INC{'Module/Load/Conditional.pm'}='../../../../Module/Load/Conditional.
Post by John E. Malmberg
Post by Craig A . Berry
l.pm'
I've therefore put a splitdir() call back into the test to break down
that list of directories, so that they can all get joined back
together in Unix style (change #31727). Hope it's still OK on VMS!
Splitdir can only be portably used on path specifications that only
contain directories. $rv-{file} contains a file specification, and so
This patch breaks VMS again.
Are you sure? I deliberately only ran splitdir() on $rv_path[1] (the
portion of @rv_path that contains the directories only) to try to avoid
problems like this.
John E. Malmberg
2007-08-20 15:47:13 UTC
Permalink
Post by Steve Hay
Post by John E. Malmberg
Post by Craig A . Berry
for VMS
Post by Craig A . Berry
Date: Thu, 16 Aug 2007 00:27:35 -0500
This breaks on Win32. File::Spec->splitpath() returns three items,
which don't necessarily have the correct flavour of slash (backslash
$INC{'Module/Load/Conditional.pm'}='../../../../Module/Load/Conditional.
Post by John E. Malmberg
Post by Craig A . Berry
l.pm'
I've therefore put a splitdir() call back into the test to break down
that list of directories, so that they can all get joined back
together in Unix style (change #31727). Hope it's still OK on VMS!
Splitdir can only be portably used on path specifications that only
contain directories. $rv-{file} contains a file specification, and so
This patch breaks VMS again.
Are you sure? I deliberately only ran splitdir() on $rv_path[1] (the
problems like this.
I will check again when I get home. The result of that line you added
changed @rv_path to contain an invalid VMS path. I may have jumped to
the wrong conclusion of what specifically caused the problem.

-John
***@qsl.network
Personal Opinion Only
Craig A. Berry
2007-08-21 01:17:35 UTC
Permalink
Post by Steve Hay
Post by John E. Malmberg
Post by Craig A . Berry
for VMS
Post by Craig A . Berry
Date: Thu, 16 Aug 2007 00:27:35 -0500
This breaks on Win32.
Sorry about that. I confess not thinking through the patch with any care.
Post by Steve Hay
Post by John E. Malmberg
Post by Craig A . Berry
I've therefore put a splitdir() call back into the test to break down
that list of directories, so that they can all get joined back
together in Unix style (change #31727). Hope it's still OK on VMS!
Splitdir can only be portably used on path specifications that only
contain directories. $rv-{file} contains a file specification, and so
This patch breaks VMS again.
Are you sure? I deliberately only ran splitdir() on $rv_path[1] (the
problems like this.
Yes, it does now break on VMS. The problem is that splitdir converts
to native syntax before splitting (I think via canonpath). Then the
whole mess gets recombined with File::Spec::Unix::catfile like so

DB<6> r
scalar context return from File::Spec::Unix::catfile: '/[000000/Module/Load]^/Conditional.pm'

so you have an unspeakable mash of incompatible syntax. The fact
that there is a splitpath but no catpath is automatically suspect,
but I haven't held my nose long enough to distinguish among what it
thinks it's doing, what it's actually doing, and what it ought to be
doing.
--
________________________________________
Craig A. Berry
mailto:***@mac.com

"... getting out of a sonnet is much more
difficult than getting in."
Brad Leithauser
John E. Malmberg
2007-08-21 02:40:56 UTC
Permalink
Post by Craig A. Berry
so you have an unspeakable mash of incompatible syntax. The fact
that there is a splitpath but no catpath is automatically suspect,
but I haven't held my nose long enough to distinguish among what it
thinks it's doing, what it's actually doing, and what it ought to be
doing.
There are a couple of bugs here that require working around for now.

Steve Hay identified a bug in splitpath on Win32

: This breaks on Win32. File::Spec->splitpath() returns three
: items, which don't necessarily have the correct flavour of
: slash (backslash or forward slash) on Win32:
:
: $INC{'Module/Load/Conditional.pm'}=
: '../../../../Module/Load/Conditional.pm'
: @rv_path = ('', '..\..\..\..\Module\Load\', 'Conditional.pm')
: File::Spec::Unix->catfile(@rv_path)=
: '..\..\..\..\Module\Load\/Conditional.pm'

On VMS, splitdir() can not handle UNIX syntax, and splitpath
unexpectedly converts the file specification to VMS. Both of these
things need to be fixed in order for Perl to function properly when the
VMS CRTL is put into UNIX mode, such as needed for running under Bash.

I have it working now on VMS and it should still work on other
platforms. A patch fixing this and a related problem will be coming
very shortly.

-John
***@qsl.net
Personal Opinion Only

Loading...