In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/d5eaec228240ca8b0e978d5ff4742f6feadef98e?hp=c6c09ee83a5807437228496363dc96efab78f90a>
- Log ----------------------------------------------------------------- commit d5eaec228240ca8b0e978d5ff4742f6feadef98e Author: Craig A. Berry <[email protected]> Date: Sat Nov 24 19:06:45 2012 -0600 Clarify reporting of .DIR extension on VMS. In readdir and start_glob, we were removing the .DIR extension from VMS directory names when reporting results in Unix format, but also when Extended Filename Syntax (EFS) was enabled. The former makes sense, but the latter (by itself) doesn't. M vms/vms.c commit 0753128385586b74fb493c6e49d37e471ee085fb Author: Craig A. Berry <[email protected]> Date: Sat Nov 24 18:46:44 2012 -0600 Handle invalid directory spec with EFS in pathify_dirspec. When Extended Filename Syntax is enabled on VMS (which is not [yet] the default), we were allowing invalid directory specifications consisting of a .DIR extension but some version other than ;1 to be passed through. Now we flag that as an invalid directory just as we were doing without EFS. This gets a test passing in vms/ext/filespec.t that was failing under EFS. M vms/vms.c ----------------------------------------------------------------------- Summary of changes: vms/vms.c | 31 ++++++++++++++++++++++--------- 1 files changed, 22 insertions(+), 9 deletions(-) diff --git a/vms/vms.c b/vms/vms.c index b08ff18..15f350b 100644 --- a/vms/vms.c +++ b/vms/vms.c @@ -6467,13 +6467,26 @@ static char * int_pathify_dirspec_simple(const char * dir, char * buf, len += n_len; if (e_len > 0) { if (decc_efs_charset) { - buf[len] = '^'; - len++; - memcpy(&buf[len], e_spec, e_len); - len += e_len; - } else { - set_vaxc_errno(RMS$_DIR); - set_errno(ENOTDIR); + if (e_len == 4 + && (toupper(e_spec[1]) == 'D') + && (toupper(e_spec[2]) == 'I') + && (toupper(e_spec[3]) == 'R')) { + + /* Corner case: directory spec with invalid version. + * Valid would have followed is_dir path above. + */ + SETERRNO(ENOTDIR, RMS$_DIR); + return NULL; + } + else { + buf[len] = '^'; + len++; + memcpy(&buf[len], e_spec, e_len); + len += e_len; + } + } + else { + SETERRNO(ENOTDIR, RMS$_DIR); return NULL; } } @@ -10140,7 +10153,7 @@ Perl_readdir(pTHX_ DIR *dd) /* In Unix report mode, remove the ".dir;1" from the name */ /* if it is a real directory. */ - if (decc_filename_unix_report || decc_efs_charset) { + if (decc_filename_unix_report && decc_efs_charset) { if (is_dir_ext(e_spec, e_len, vs_spec, vs_len)) { Stat_t statbuf; int ret_sts; @@ -13168,7 +13181,7 @@ Perl_vms_start_glob /* In Unix report mode, remove the ".dir;1" from the name */ /* if it is a real directory */ - if (decc_filename_unix_report || decc_efs_charset) { + if (decc_filename_unix_report && decc_efs_charset) { if (is_dir_ext(e_spec, e_len, vs_spec, vs_len)) { Stat_t statbuf; int ret_sts; -- Perl5 Master Repository
