Skip Menu |

This queue is for tickets about the ExtUtils-Install CPAN distribution.

Report information
The Basics
Id: 42149
Status: open
Priority: 0/
Queue: ExtUtils-Install

People
Owner: Nobody in particular
Requestors: wb8tyw [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.52
Fixed in: (no value)



Subject: Add support for VMS in Unix or extended character set modes.
This patch updates Install.pm and INST.t, INST_PREFIX.t to support VMS in the Unix compatible mode and with extended character sets.
Subject: extutils_install.patch
--- /rsync_root/perl/lib/Extutils/install.pm Wed Nov 12 13:52:11 2008 +++ lib/Extutils/install.pm Sun Jan 4 16:02:34 2009 @@ -92,11 +92,34 @@ =cut my $Is_VMS = $^O eq 'VMS'; +my $Is_VMS_noefs = $Is_VMS; my $Is_MacPerl = $^O eq 'MacOS'; my $Is_Win32 = $^O eq 'MSWin32'; my $Is_cygwin = $^O eq 'cygwin'; my $CanMoveAtBoot = ($Is_Win32 || $Is_cygwin); + if( $Is_VMS ) { + my $vms_unix_rpt; + my $vms_efs; + my $vms_case; + + if (eval { local $SIG{__DIE__}; require VMS::Feature; }) { + $vms_unix_rpt = VMS::Feature::current("filename_unix_report"); + $vms_efs = VMS::Feature::current("efs_charset"); + $vms_case = VMS::Feature::current("efs_case_preserve"); + } else { + my $unix_rpt = $ENV{'DECC$FILENAME_UNIX_REPORT'} || ''; + my $efs_charset = $ENV{'DECC$EFS_CHARSET'} || ''; + my $efs_case = $ENV{'DECC$EFS_CASE_PRESERVE'} || ''; + $vms_unix_rpt = $unix_rpt =~ /^[ET1]/i; + $vms_efs = $efs_charset =~ /^[ET1]/i; + $vms_case = $efs_case =~ /^[ET1]/i; + } + $Is_VMS_noefs = 0 if ($vms_efs); + } + + + # *note* CanMoveAtBoot is only incidentally the same condition as below # this needs not hold true in the future. my $Has_Win32API_File = ($Is_Win32 || $Is_cygwin) @@ -405,7 +428,9 @@ my $path=''; my @make; while (@dirs) { - if ($Is_VMS) { + if ($Is_VMS_noefs) { + # There is a bug in catdir that is fixed when the EFS character + # set is enabled, which requires this VMS specific code. $dir = File::Spec->catdir($vol,@dirs); } else { --- /rsync_root/perl/lib/Extutils/t/INST.t Tue Jun 13 14:29:14 2006 +++ lib/Extutils/t/INST.t Thu Dec 25 01:46:50 2008 @@ -24,6 +24,8 @@ use TieOut; use Config; +my $Is_VMS = $^O eq 'VMS'; + chdir 't'; perl_lib; @@ -74,6 +76,7 @@ my($perl_src, $mm_perl_src); if( $ENV{PERL_CORE} ) { $perl_src = File::Spec->catdir($Updir, $Updir); + $perl_src = VMS::Filespec::vmsify($perl_src) if $Is_VMS; $perl_src = File::Spec->canonpath($perl_src); $mm_perl_src = File::Spec->canonpath($mm->{PERL_SRC}); } @@ -90,22 +93,28 @@ # INST_* +my $expect = File::Spec->catdir($Curdir, 'blib', 'arch'); +$expect = VMS::Filespec::vmspath($expect) if $Is_VMS; is( $mm->{INST_ARCHLIB}, $mm->{PERL_CORE} ? $mm->{PERL_ARCHLIB} - : File::Spec->catdir($Curdir, 'blib', 'arch'), - 'INST_ARCHLIB'); -is( $mm->{INST_BIN}, File::Spec->catdir($Curdir, 'blib', 'bin'), - 'INST_BIN' ); + : $expect, + 'INST_ARCHLIB'); +$expect = File::Spec->catdir($Curdir, 'blib', 'bin'); +$expect = VMS::Filespec::vmspath($expect) if $Is_VMS; +is( $mm->{INST_BIN}, $expect, 'INST_BIN' ); is( keys %{$mm->{CHILDREN}}, 1 ); my($child_pack) = keys %{$mm->{CHILDREN}}; my $c_mm = $mm->{CHILDREN}{$child_pack}; +$expect = File::Spec->catdir($Updir, 'blib', 'arch'); +$expect = VMS::Filespec::vmspath($expect) if $Is_VMS; is( $c_mm->{INST_ARCHLIB}, $c_mm->{PERL_CORE} ? $c_mm->{PERL_ARCHLIB} - : File::Spec->catdir($Updir, 'blib', 'arch'), - 'CHILD INST_ARCHLIB'); -is( $c_mm->{INST_BIN}, File::Spec->catdir($Updir, 'blib', 'bin'), - 'CHILD INST_BIN' ); + : $expect, + 'CHILD INST_ARCHLIB'); +$expect = File::Spec->catdir($Updir, 'blib', 'bin'); +$expect = VMS::Filespec::vmspath($expect) if $Is_VMS; +is( $c_mm->{INST_BIN}, $expect, 'CHILD INST_BIN' ); my $inst_lib = File::Spec->catdir($Curdir, 'blib', 'lib'); --- /rsync_root/perl/lib/Extutils/t/INST_PREFIX.t Tue Jun 13 14:29:14 2006 +++ lib/Extutils/t/INST_PREFIX.t Thu Dec 25 01:35:29 2008 @@ -103,6 +103,7 @@ my($perl_src, $mm_perl_src); if( $ENV{PERL_CORE} ) { $perl_src = File::Spec->catdir($Updir, $Updir); + $perl_src = VMS::Filespec::vmsify($perl_src) if $Is_VMS; $perl_src = File::Spec->canonpath($perl_src); $mm_perl_src = File::Spec->canonpath($mm->{PERL_SRC}); } @@ -153,6 +154,7 @@ _set_config(installman3dir => ''); my $wibble = File::Spec->catdir(qw(wibble and such)); + $wibble = VMS::Filespec::vmspath($wibble) if $Is_VMS; my $stdout = tie *STDOUT, 'TieOut' or die; my $mm = WriteMakefile( NAME => 'Big::Dummy', @@ -187,7 +189,9 @@ INSTALLMAN3DIR=> 'foo/bar/baz', ); - is( $mm->{INSTALLVENDORMAN1DIR}, File::Spec->catdir('foo','bar'), + my $expect = File::Spec->catdir('foo','bar'); + $expect = VMS::Filespec::vmspath($expect) if $Is_VMS; + is( $mm->{INSTALLVENDORMAN1DIR}, $expect, 'installvendorman1dir (in %Config) not modified' ); isnt( $mm->{INSTALLVENDORMAN3DIR}, '', 'installvendorman3dir (not in %Config) set' ); @@ -212,9 +216,14 @@ VERSION_FROM => 'lib/Big/Dummy.pm', PERL_CORE => $ENV{PERL_CORE}, ); - - is( $mm->{INSTALLMAN1DIR}, File::Spec->catdir('foo', 'bar') ); - is( $mm->{INSTALLMAN3DIR}, File::Spec->catdir('foo', 'baz') ); + my $expect1 = File::Spec->catdir('foo', 'bar'); + my $expect2 = File::Spec->catdir('foo', 'baz'); + if ($Is_VMS) { + $expect1 = VMS::Filespec::vmspath($expect1); + $expect2 = VMS::Filespec::vmspath($expect2); + } + is( $mm->{INSTALLMAN1DIR}, $expect1 ); + is( $mm->{INSTALLMAN3DIR}, $expect2 ); SKIP: { skip "VMS must expand macros in INSTALL* vars", 4 if $Is_VMS; @@ -246,8 +255,14 @@ PERL_CORE => $ENV{PERL_CORE}, ); - is( $mm->{INSTALLMAN1DIR}, File::Spec->catdir('foo', 'bar') ); - is( $mm->{INSTALLMAN3DIR}, File::Spec->catdir('foo', 'baz') ); + my $expect1 = File::Spec->catdir('foo', 'bar'); + my $expect2 = File::Spec->catdir('foo', 'baz'); + if ($Is_VMS) { + $expect1 = VMS::Filespec::vmspath($expect1); + $expect2 = VMS::Filespec::vmspath($expect2); + } + is( $mm->{INSTALLMAN1DIR}, $expect1 ); + is( $mm->{INSTALLMAN3DIR}, $expect2 ); SKIP: { skip "VMS must expand macros in INSTALL* vars", 2 if $Is_VMS; is( $mm->{INSTALLSITEMAN1DIR}, '$(INSTALLMAN1DIR)' );
What I'm seeing in this patch is a whole lot of code that says I can no longer trust the output of File::Spec on VMS and have to put in a lot of special case code. - is( $mm->{INSTALLVENDORMAN1DIR}, File::Spec->catdir('foo','bar'), + my $expect = File::Spec->catdir('foo','bar'); + $expect = VMS::Filespec::vmspath($expect) if $Is_VMS; + is( $mm->{INSTALLVENDORMAN1DIR}, $expect, 'installvendorman1dir (in %Config) not modified' ); This sucks. I don't want to be sprinkling "if $Is_VMS" all over the place. There's got to be a better way to handle this. My first thought is why isn't File::Spec taking care of this? Also, what is this stuff even doing? What's all this about? + if( $Is_VMS ) { + my $vms_unix_rpt; + my $vms_efs; + my $vms_case; + + if (eval { local $SIG{__DIE__}; require VMS::Feature; }) { + $vms_unix_rpt = VMS::Feature::current("filename_unix_report"); + $vms_efs = VMS::Feature::current("efs_charset"); + $vms_case = VMS::Feature::current("efs_case_preserve"); + } else { + my $unix_rpt = $ENV{'DECC$FILENAME_UNIX_REPORT'} || ''; + my $efs_charset = $ENV{'DECC$EFS_CHARSET'} || ''; + my $efs_case = $ENV{'DECC$EFS_CASE_PRESERVE'} || ''; + $vms_unix_rpt = $unix_rpt =~ /^[ET1]/i; + $vms_efs = $efs_charset =~ /^[ET1]/i; + $vms_case = $efs_case =~ /^[ET1]/i; + } + $Is_VMS_noefs = 0 if ($vms_efs); + } Why are $vms_case and $vms_unix_rpt being set? Nothing uses them. Why do we have to go through all those hoops just to figure out if the extended filesystem is in effect? Why isn't this in a module somewhere?
Subject: Re: [rt.cpan.org #42149] Add support for VMS in Unix or extended character set modes.
Date: Wed, 01 Apr 2009 20:30:03 -0500
To: bug-ExtUtils-Install [...] rt.cpan.org
From: "John E. Malmberg" <malmberg [...] Encompasserve.org>
Michael G Schwern via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=42149 > > > What I'm seeing in this patch is a whole lot of code that says I can no > longer trust the output of File::Spec on VMS and have to put in a lot of > special case code. > > - is( $mm->{INSTALLVENDORMAN1DIR}, File::Spec->catdir('foo','bar'), > + my $expect = File::Spec->catdir('foo','bar'); > + $expect = VMS::Filespec::vmspath($expect) if $Is_VMS; > + is( $mm->{INSTALLVENDORMAN1DIR}, $expect, > 'installvendorman1dir (in %Config) not modified' );
Most perl modules I have encountered have to have special case code to deal with File::Spec changing Unix file specifications to VMS format. This module is one of the few that want Unix file specifications to turn into VMS, because it is writing a MMS file. So the behavior now for File::Spec is that if the DECC$EFS_CHARSET feature is in affect that it will preserve the input format of the file specifications to the output. Which means that more Perl modules written with for Unix will now just work on VMS when that feature is enabled. A second feature DECC$FILENAME_UNIX_REPORT controls the output of routines that output file specifications with out knowing the the format of the input specifications. The combination of these features set before running Perl increases the number of perl scripts that will just run on Perl with out needing any VMS specific changes. Show quoted text
> This sucks. I don't want to be sprinkling "if $Is_VMS" all over the > place. There's got to be a better way to handle this. > > My first thought is why isn't File::Spec taking care of this?
File::Spec changing Unix file specifications to VMS is actually the cause of most portability problems that I have had to fix. If it traditionally had not changed the file format to VMS from UNIX, a lot of VMS specific code could be removed Perl. It is ironic that a feature introduced for portability actually made portability harder. The need for VMS syntax format is actually more an issue of the MAKE program that VMS is using. MMS and MMK need to have the filenames in VMS format. GNU make on VMS will need it in UNIX format. Show quoted text
> Also, what is this stuff even doing? What's all this about? > > + if( $Is_VMS ) { > + my $vms_unix_rpt; > + my $vms_efs; > + my $vms_case; > + > + if (eval { local $SIG{__DIE__}; require VMS::Feature; }) { > + $vms_unix_rpt = VMS::Feature::current("filename_unix_report"); > + $vms_efs = VMS::Feature::current("efs_charset"); > + $vms_case = VMS::Feature::current("efs_case_preserve"); > + } else { > + my $unix_rpt = $ENV{'DECC$FILENAME_UNIX_REPORT'} || ''; > + my $efs_charset = $ENV{'DECC$EFS_CHARSET'} || ''; > + my $efs_case = $ENV{'DECC$EFS_CASE_PRESERVE'} || ''; > + $vms_unix_rpt = $unix_rpt =~ /^[ET1]/i; > + $vms_efs = $efs_charset =~ /^[ET1]/i; > + $vms_case = $efs_case =~ /^[ET1]/i; > + } > + $Is_VMS_noefs = 0 if ($vms_efs); > + }
The eval first tries to see if the VMS::Feature module is present. If it is, then it will be used to look up the feature as it will be the most reliable method. If VMS::Feature is not present, then the logical name is looked up through the $ENV hash. Not the best, but currently the only method that can be assumed available on all Perl. Show quoted text
> Why are $vms_case and $vms_unix_rpt being set? Nothing uses them.
They are left over from a commmon cut and paste. They can be removed from this patch. Show quoted text
> Why > do we have to go through all those hoops just to figure out if the > extended filesystem is in effect? Why isn't this in a module somewhere?
I plan to add the VMS::Feature module to support reading and setting the mode that VMS is in. The extra hoops are in place so that dual life modules will work correctly with out the VMS::Feature module being present. Regards, -John malmberg@encompasserve.org