Rework vms/vms.c:Perl_flex_stat_int() to avoid underscore ambiguity.
An apparently long-standing bug in the home-grown stat() wrapper
was exposed by b8ab4b0, which added the t/test_pl directory. On
VMS, file test operations using the Perl_flex_stat_int() function
would confuse t/test.pl with t/test_pl because dots are the directory
delimiter and not traditionally allowed in directory names, so when
doing a stat() of t/test.pl it would convert the dot to an underscore
and succeed because that directory now exists. All tests using
t/test.pl would then fail.
The background is that traditionally, the CRTL stat() could not deal
with directory specifications in native format, so for example,
dev:[dir.dir2] had to be converted to dev:[dir]dir2.DIR for various
operations, including the stat() call, to succeed. This is now the
exception; it's still necessary for rmdir(), but not for stat(), at
least not on OpenVMS VAX v7.3, OpenVMS Alpha v7.3-2, OpenVMS Alpha
v8.3, and OpenVMS I64 v8.4, i.e., anything released in the last
eight years. A so-called "fileified" directory spec did not cause
problems on its own, but if converted to native syntax first, the
dot would get replace with the now-ambiguous underscore.
The balance was tipped in
312ac60b381, where the fatal conversion
to a native path was added. The best path forward seems to be to
do less and allow the CRTL stat() or lstat() to do their thing
unimpeded, which in most cases they do just fine. This has the
added benefit of optimizing for files instead of directories and
saving some unnecessary filename conversions and filename buffer
allocations. More refactorings are likely desireable.
There is one new test failure in dist/ExtUtils-Manifest/t/Manifest.t
having to do with a filename containing a space, but this seems
preferable to the hundreds of test failures before this patch. That
indicates, however, that there is more work to do.