There is no reason anymore to have VMS::Filespec::vms_realpath be
dependent on symbolic links being present. Same for
VMS::Filespec::vms_case_tolerant.
It looks like another API is needed. vms_realpath will always return a
UNIX format pathname, and for for compatibility with existing code, we
need a routine that returns a VMS format pathname.
To keep things simple, I would like that routine to have a different
name than vms_realpath, such as vms_realname.
This is so that vms_realname() will always return the "primary link" in
VMS format to a file.
vms_realpath() first attempts to return the realpath() in UNIX format to
a file, and if it is unable to do that for any reason, it falls back to
returning the name of the primary link to a file in UNIX format.
I will update the VMS::Filespec pod after I get the vms_realname api
implemented.
-John
[EMAIL PROTECTED]
Personal Opinion Only
--- /rsync_root/perl/vms/vms.c Mon Nov 5 22:17:09 2007
+++ vms/vms.c Sun Nov 11 00:38:25 2007
@@ -12903,7 +12903,6 @@
}
-#ifdef HAS_SYMLINK
static char *
mp_do_vms_realpath(pTHX_ const char *filespec, char * rslt_spec,
int *utf8_fl);
@@ -12932,6 +12931,7 @@
XSRETURN(1);
}
+#ifdef HAS_SYMLINK
/*
* A thin wrapper around decc$symlink to make sure we follow the
* standard and do not create a symlink with a zero-length name.
@@ -12948,7 +12948,6 @@
#endif /* HAS_SYMLINK */
-#if __CRTL_VER >= 70301000 && !defined(__VAX)
int do_vms_case_tolerant(void);
void
@@ -12958,7 +12957,6 @@
ST(0) = boolSV(do_vms_case_tolerant());
XSRETURN(1);
}
-#endif
void
Perl_sys_intern_dup(pTHX_ struct interp_intern *src,
@@ -13010,21 +13008,15 @@
newXSproto("DynaLoader::mod2fname", mod2fname, file, "$");
newXS("File::Copy::rmscopy",rmscopy_fromperl,file);
newXSproto("vmsish::hushed",hushexit_fromperl,file,";$");
-#ifdef HAS_SYMLINK
newXSproto("VMS::Filespec::vms_realpath",vms_realpath_fromperl,file,"$;$");
-#endif
-#if __CRTL_VER >= 70301000 && !defined(__VAX)
newXSproto("VMS::Filepec::vms_case_tolerant",
vms_case_tolerant_fromperl, file, "$");
-#endif
store_pipelocs(aTHX); /* will redo any earlier attempts */
return;
}
-#ifdef HAS_SYMLINK
-
#if __CRTL_VER == 80200000
/* This missed getting in to the DECC SDK for 8.2 */
char *realpath(const char *file_name, char * resolved_name, ...);
@@ -13064,14 +13056,14 @@
if (sts == 0) {
dvidsc.dsc$a_pointer=statbuf.st_dev;
- dvidsc.dsc$w_length=strlen(statbuf.st_dev);
+ dvidsc.dsc$w_length=strlen(statbuf.st_dev);
specdsc.dsc$a_pointer = outname;
specdsc.dsc$w_length = outlen-1;
- sts = lib$fid_to_name
- (&dvidsc, statbuf.st_ino, &specdsc, &specdsc.dsc$w_length);
- if ($VMS_STATUS_SUCCESS(sts)) {
+ sts = lib$fid_to_name
+ (&dvidsc, statbuf.st_ino, &specdsc, &specdsc.dsc$w_length);
+ if ($VMS_STATUS_SUCCESS(sts)) {
outname[specdsc.dsc$w_length] = 0;
return 0;
}
@@ -13087,8 +13079,15 @@
{
char * rslt = NULL;
- if (decc_posix_compliant_pathnames)
- rslt = realpath(filespec, outbuf);
+#ifdef HAS_SYMLINK
+ if (decc_posix_compliant_pathnames > 0 ) {
+ /* realpath currently only works if posix compliant pathnames are
+ * enabled. It may start working when they are not, but in that
+ * case we still want the fallback behavior for backwards compatibility
+ */
+ rslt = realpath(filespec, outbuf);
+ }
+#endif
if (rslt == NULL) {
char * vms_spec;
@@ -13100,8 +13099,8 @@
Newx(vms_spec, VMS_MAXRSS + 1, char);
- sts = vms_fid_to_name(vms_spec, VMS_MAXRSS + 1, filespec);
- if (sts == 0) {
+ sts = vms_fid_to_name(vms_spec, VMS_MAXRSS + 1, filespec);
+ if (sts == 0) {
/* Now need to trim the version off */
@@ -13142,13 +13141,7 @@
/* External entry points */
char *Perl_vms_realpath(pTHX_ const char *filespec, char *outbuf, int *utf8_fl)
{ return do_vms_realpath(filespec, outbuf, utf8_fl); }
-#else
-char *Perl_vms_realpath(pTHX_ const char *filespec, char *outbuf, int *utf8_fl)
-{ return NULL; }
-#endif
-
-#if __CRTL_VER >= 70301000 && !defined(__VAX)
/* case_tolerant */
/*{{{int do_vms_case_tolerant(void)*/
@@ -13161,6 +13154,7 @@
}
/*}}}*/
/* External entry points */
+#if __CRTL_VER >= 70301000 && !defined(__VAX)
int Perl_vms_case_tolerant(void)
{ return do_vms_case_tolerant(); }
#else