From 0f669c9d195bffa8ed03ffc8a452415a7246a942 Mon Sep 17 00:00:00 2001 From: "Craig A. Berry" Date: Sat, 25 Jan 2014 09:52:09 -0600 Subject: [PATCH] In vms.c's Perl_opendir, skip access check on remotes. As reported in [perl #121002], the homegrown opendir has been failing when the directory specification contains a DECNet node specification indicating the directory to be accessed is on a remote node. The OP reports this worked with Perl 5.001 but not 5.8.6 or 5.18.2. It appears that the culprit was the introduction of access checking to Perl_opendir in 61bb59065bf1b12edab39b12, which would first have been released in 5.004. Yes, it's been broken for 17 years. The reason access checking broke remote access is that it's based on SYS$CHECK_ACCESS, which apparently does not work on remotes, though the only hint of that in its documentation is that the status SS$_UNSUPPORTED, "Operations on remote object are not supported" is listed as a possible return value. What it actually returns, despite the documentation, is SS$_INVFILFOROP, "invalid file specification for operation." The fix is simple enough -- just skip the access check if the directory name contains a node specification (which always ends with "::"). All the access check is providing is a friendlier error message in cases where we don't have access, so no harm is done by skipping the check in cases where it can't work. --- vms/vms.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vms/vms.c b/vms/vms.c index cbc47d2..c0fa4e4 100644 --- a/vms/vms.c +++ b/vms/vms.c @@ -9977,7 +9977,8 @@ Perl_opendir(pTHX_ const char *name) /* Check access before stat; otherwise stat does not * accurately report whether it's a directory. */ - if (!cando_by_name_int(S_IRUSR,0,dir,PERL_RMSEXPAND_M_VMS_IN)) { + if (!strstr(dir, "::") /* sys$check_access doesn't do remotes */ + && !cando_by_name_int(S_IRUSR,0,dir,PERL_RMSEXPAND_M_VMS_IN)) { /* cando_by_name has already set errno */ Safefree(dir); return NULL; -- 2.7.4