cwd.t changes for UNIX/POSIX/symbolic links
This difference listing shows how I am checking the DECC feature logicals to so that the Perl script will handle pathnames in the same way that the CRTL has been told to. It is against the 5.8.7 perl as I had to install the pathtool patch on Perl 5.8.6 which is now part of 5.8.7. Use of some of the DECC$ feature logicals that I have in these patches may not work properly until all the patches that I have are installed. However using those same feature logicals now on the Perl from CPAN with out any of my patches is probably also not going to work in the same way. So these patches should be able to be applied to a bleadperl in advance of the entire set being applied. I am not doing the value check of the logical names exactly the same as the CRTL. While the CRTL is more liberal on what it will accept for an ENABLE setting, HP recommends that the string ENABLE be used on them. So this is how The DECC$POSIX_COMPLIANT_PATHNAMES is active with a value from 1 to 4, where 4 is a special mode that disallows UNIX names being passed to the CRTL. I do not see 4 as a valid mode to run Perl in. And this value range is still subject to change. Currently mode 0 (or undefined) or mode 3 is the only one that will work with the Symbolic Link SDK. If you do not have the symbolic link SDK, then there is no reason for this logical name to be defined. But that is why I an checking for non-zero, and not 3. The DECC$FILENAME_UNIX_ONLY means that the CRTL assumes that all pathnames given to it will be UNIX. So it will treat X:[FOO]BAR as the VMS file specification []X^:^[FOO^]BAR.. I do not see this as a useful mode of running Perl, but am putting in the foundation of this just in case someone else wants to complete the job. The DECC$FILENAME_UNIX_ONLY also implies DECC$FILENAME_REPORT_UNIX. In DECC$FILENAME_UNIX_REPORT mode, the CRTL will default to returning UNIX specifications, but still will accept VMS ones. Of course sometimes it is not possible to detect the difference, and on an ODS-5 volume, the UNIX Perl.5.8.7 can exist as [.Perl^.5^.8^.7]. Many of the Perl scripts needed modifications based on what the DECC$ feature logicals implied. One of the things I have discovered is that in the UNIX_REPORT modes, Perl seems to be able to find the GNV components when they are installed and tries to use them in the tests. Unfortunately if there is a conflicting DCL verb, the results may be not what you expect. In this case, the GNV pwd command is the quickest way I have to get the current working directory in a UNIX format outside of Perl. In debugging this case, I discovered that Perl on VMS is depending on the CRTL accepting a previously invalid pathname to the chdir() routine. Perl is passing that argument with leading spaces. Leading spaces are valid in filenames on ODS-5 volumes, so in a UNIX mode, chdir foo would be expected to do a change dir to [.^_^_foo]. In order to keep from having to find all the perl scripts that are taking the output of SHOW DEFAULT or equivalent with out trimming the spaces, I have modified the chdir() in VMS.C to trim the leading spaces off. [I may have forgotten to put this in a readme file] -John [EMAIL PROTECTED] Personal Opinion Only --- ext/Cwd/t/cwd.t_5_8_6 Mon Mar 14 15:25:16 2005 +++ ext/Cwd/t/cwd.t Wed Jun 15 15:19:11 2005 @@ -1,31 +1,64 @@ -#!./perl +#!./perl -w BEGIN { -chdir 't' if -d 't'; if ($ENV{PERL_CORE}) { +chdir 't'; @INC = '../lib'; } } use Cwd; +chdir 't'; -use Config; use strict; -use warnings; +use Config; use File::Spec; use File::Path; +use lib File::Spec-catdir('t', 'lib'); use Test::More; +require VMS::Filespec if $^O eq 'VMS'; -my $tests = 24; -my $EXTRA_ABSPATH_TESTS = $ENV{PERL_CORE} || $ENV{TEST_PERL_CWD_CODE}; +my $tests = 28; # _perl_abs_path() currently only works when the directory separator # is '/', so don't test it when it won't work. -$EXTRA_ABSPATH_TESTS = $Config{prefix} =~ m/\//; -$tests += 3 if $EXTRA_ABSPATH_TESTS; +my $EXTRA_ABSPATH_TESTS = ($Config{prefix} =~ m/\//) $^O ne 'cygwin'; +$tests += 4 if $EXTRA_ABSPATH_TESTS; plan tests = $tests; +SKIP: { + skip no need to check for blib/ in the core, 1 if $ENV{PERL_CORE}; + like $INC{'Cwd.pm'}, qr{blib}i, Cwd should be loaded from blib/ during testing; +} + my $IsVMS = $^O eq 'VMS'; my $IsMacOS = $^O eq 'MacOS'; +my $posix_compliant; +my $unix_report; +my $unix_only; + +if ($IsVMS) { +$posix_compliant = $ENV{'DECC$POSIX_COMPLIANT_PATHNAMES'}; +if (defined $posix_compliant) { + if (($posix_compliant lt '1') ($posix_compliant ne 'ENABLE')) { + $posix_compliant = undef; + } +} +$unix_report = $ENV{'DECC$FILENAME_UNIX_REPORT'}; +if (defined $unix_report) { + if (($unix_report lt '1') ($unix_report ne 'ENABLE')) { + $unix_report = undef; + } +} +$unix_only = $ENV{'DECC$FILENAME_UNIX_ONLY'}; +if
ext/file/glob/t/basic.t and ext/posix/t/posix.t changes.
These diffs are against 5.8.7. Essentially allow these test to be run in a UNIX emulation mode. For the 64 bit OpenVMS, what really needs to be done is that all the test scripts need to be run in the default mode, and then in a UNIX REPORT mode, and when the future VMS comes out with the POSIX mode, a third time. Of course if the UNIX ONLY mode is implemented, then there will eventually be two flavors of that, POSIX and traditional. Of course if you make a matrix of all the current possible ways that the CRTL can be told to interpret a UNIX pathname, it would take quite a large number of test runs to cover all of them, assuming that Perl and the test modes were changed to handle them also. For now, I am sticking a bunch of features that result in pathnames by default being reported as UNIX format, with support for the future POSIX mode that assumes pathnames are VMS if they are ambiguous. This is probably enough new topics for today. -John [EMAIL PROTECTED] Personal Opinion Only --- ext/File/Glob/t/basic.t_5_8_7 Tue Jul 12 17:44:21 2005 +++ ext/File/Glob/t/basic.t Tue Jul 12 17:53:02 2005 @@ -111,20 +111,70 @@ } print ok 7\n; +# VMS can pretend it is UNIX. + +my $IsVMS = $^O eq 'VMS'; +my $posix_compliant; +my $unix_report; +my $unix_only; +my $case_preserved = 1; +my $vms_drop_dot; +my $vms_format = 0; +if ($IsVMS) { +$vms_format = 1; +$posix_compliant = $ENV{'DECC$POSIX_COMPLIANT_PATHNAMES'}; +if (defined $posix_compliant) { + if (($posix_compliant lt '1') ($posix_compliant ne 'ENABLE')) { + $posix_compliant = undef; + } +} +$unix_report = $ENV{'DECC$FILENAME_UNIX_REPORT'}; +if (defined $unix_report) { + if (($unix_report lt '1') ($unix_report ne 'ENABLE')) { + $unix_report = undef; + } +} +$unix_only = $ENV{'DECC$FILENAME_UNIX_ONLY'}; +if (defined $unix_only) { + if (($unix_only lt '1') ($unix_only ne 'ENABLE')) { + $unix_only = undef; + } +} +$unix_report = 1 if (defined $unix_only); + +$case_preserved = $ENV{'DECC$EFS_CASE_PRESERVE'}; +if (defined $case_preserved) { + if (($case_preserved lt '1') ($case_preserved ne 'ENABLE')) { + $case_preserved = undef; + } +} +$vms_drop_dot = $ENV{'DECC$READDIR_DROPDOTNOTYPE'}; +if (defined $vms_drop_dot) { + if (($vms_drop_dot lt '1') ($vms_drop_dot ne 'ENABLE')) { + $vms_drop_dot = undef; + } +} +if ((defined $unix_report) (defined $vms_drop_dot)) { + $vms_format = 0 +} +} + @a = bsd_glob( '{TES*,doesntexist*,a,b}', -GLOB_BRACE | GLOB_NOMAGIC | ($^O eq 'VMS' ? GLOB_NOCASE : 0) +GLOB_BRACE | GLOB_NOMAGIC | (!(defined $case_preserved) ? GLOB_NOCASE : 0) ); # Working on t/TEST often causes this test to fail because it sees Emacs temp # and RCS files. Filter them out, and .pm files too, and patch temp files. @a = grep !/(,v$|~$|\.(pm|ori?g|rej)$)/, @a; [EMAIL PROTECTED] = (grep !/test.pl/, @a) if $^O eq 'VMS'; +if (($^O eq 'VMS') !(defined $unix_report)) { +@a = (grep !/test.pl/, @a); +} print # @a\n; unless (@a == 3 -and $a[0] eq ($^O eq 'VMS'? 'test.' : 'TEST') + and $a[0] eq ($vms_format ? 'test.' : 'TEST') and $a[1] eq 'a' and $a[2] eq 'b') { @@ -150,7 +200,8 @@ if ('a' lt 'A') { # EBCDIC char sets sort lower case before UPPER @f_names = sort(@f_names); } -if ($^O eq 'VMS') { # VMS is happily caseignorant +# VMS is normally happily caseignorant +if (($^O eq 'VMS') !(defined $case_preserved)) { @f_alpha = qw(ax.pl ay.pl bx.pl by.pl cx.pl cy.pl); @f_names = @f_alpha; } --- ext/Posix/t/posix.t_5_8_7 Tue Jul 12 17:57:55 2005 +++ ext/Posix/t/posix.t Tue Jul 12 17:58:09 2005 @@ -28,6 +28,34 @@ $Is_UWin= $^O eq 'uwin'; $Is_OS390 = $^O eq 'os390'; +# VMS can pretend it is UNIX. +my $posix_compliant; +my $unix_report; +my $unix_only; +if ($Is_VMS) { +$posix_compliant = $ENV{'DECC$POSIX_COMPLIANT_PATHNAMES'}; +if (defined $posix_compliant) { + if (($posix_compliant lt '1') ($posix_compliant ne 'ENABLE')) { + $posix_compliant = undef; + } +} +$unix_report = $ENV{'DECC$FILENAME_UNIX_REPORT'}; +if (defined $unix_report) { + if (($unix_report lt '1') ($unix_report ne 'ENABLE')) { + $unix_report = undef; + } +} +$unix_only = $ENV{'DECC$FILENAME_UNIX_ONLY'}; +if (defined $unix_only) { + if (($unix_only lt '1') ($unix_only ne 'ENABLE')) { + $unix_only = undef; + } +} +$unix_report = 1 if (defined $unix_only); +} + + + ok( $testfd = open(TEST, O_RDONLY, 0),'O_RDONLY with open' ); read($testfd, $buffer, 4) if $testfd 2; is( $buffer, #!./, 'with read' ); @@ -128,7 +156,7 @@ if ($Is_MacOS) { $pat = qr/:t:$/; } -elsif ( $Is_VMS ) { +elsif ( $Is_VMS !(defined $unix_report)) { $pat = qr/\.T]/i; } else {
Re: Hard link support for VMS (part 2)
[EMAIL PROTECTED] wrote: At 6:43 PM -0400 7/11/05, John Malmberg wrote: Perl_setup.com is optionally built such that it defines perl_root based on the directory it currently resides in, as a step toward being able to build a binary distribution kit that does not require editing it. I'd recommend writing a perl script or DCL procedure that does the editing. At the very least make the relocatable perl_setup.com a non default option offered by configure.com. It is implemented as a slightly hidden non-default option. For CGI scripts and other advanced setups obviously there are better ways of doing it, by using the JOB, GROUP, SYSTEM or custom tables. I just discovered that the *.OPT files in the build directory have absolute pathnames in then, and the ones in the directory created by the install step have absolute files. It gets me curious of why not simply use logical names in the option files, and use $define/user or $define in the build procedure. -John [EMAIL PROTECTED] Personal Opinion Only