In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/839e16da0363c53aae2388f75df22258f1540677?hp=656d3f9a2ce7fdcdbecec968ce50147d17c391e1>

- Log -----------------------------------------------------------------
commit 839e16da0363c53aae2388f75df22258f1540677
Author: Craig A. Berry <[email protected]>
Date:   Sat Jan 28 09:22:04 2012 -0600

    Restore directory extension and version in fileify under EFS.
    
    In df2786654 and 8a5aa89570, the traditional behavior of adding
    the .DIR;1 onto a fileified directory spec was removed when
    operating under Extended Filename Syntax.  Various scary comments
    were added about its being a bug to add a type and version onto
    a Unix-style path, but actually the CRTL appears to be perfectly
    happy with, for example:
    
       stat('/foo/bar/baz.dir;1');
    
    and without the extension, the home-grown rmdir() fails in the
    case of a directory with no preceding path information.  E.g.,
    
       rmdir('foo');
    
    was failing because there was no internal translation to foo.dir
    before passing it to SYS$ERASE.
    
    Moreover, even if there were something wrong with adding .DIR;1,
    it has nothing to do with EFS.

M       vms/ext/filespec.t
M       vms/vms.c

commit 37769287773a12dbc22e9f93bf7f8c55068aafe2
Author: Craig A. Berry <[email protected]>
Date:   Sat Jan 28 08:59:09 2012 -0600

    filelify shouldn't always escape dots.
    
    Follow-up to a9fac63d75d9222a73fbf511ca58ae1d66cbf9a7.  It turns
    out that the CRTL doesn't handle the escapes when the path is in
    Unix syntax (even though it requires them in native syntax).
    
      stat('foo/bar.baz.dir;1')
    
    is ok, but
    
      stat('foo/bar^.baz.dir;1')
    
    fails.  So skip the escaping if there is a slash anywhere in the
    path.

M       vms/vms.c
-----------------------------------------------------------------------

Summary of changes:
 vms/ext/filespec.t |   10 +++---
 vms/vms.c          |   80 ++++------------------------------------------------
 2 files changed, 11 insertions(+), 79 deletions(-)

diff --git a/vms/ext/filespec.t b/vms/ext/filespec.t
index f5f71ce..86cdc76 100755
--- a/vms/ext/filespec.t
+++ b/vms/ext/filespec.t
@@ -130,14 +130,14 @@ __some_/__where_/...   vmsify  [.__some_.__where_...] ^*
 # Fileifying directory specs
 __down_:[__the_.__garden_.__path_]     fileify 
__down_:[__the_.__garden_]__path_.dir;1 ^
 [.__down_.__the_.__garden_.__path_]    fileify 
[.__down_.__the_.__garden_]__path_.dir;1 ^
-/__down_/__the_/__garden_/__path_      fileify 
/__down_/__the_/__garden_/__path_.dir;1 /__down_/__the_/__garden_/__path_
-/__down_/__the_/__garden_/__path_/     fileify 
/__down_/__the_/__garden_/__path_.dir;1 /__down_/__the_/__garden_/__path_
-__down_/__the_/__garden_/__path_       fileify 
__down_/__the_/__garden_/__path_.dir;1 __down_/__the_/__garden_/__path_
+/__down_/__the_/__garden_/__path_      fileify 
/__down_/__the_/__garden_/__path_.dir;1 ^
+/__down_/__the_/__garden_/__path_/     fileify 
/__down_/__the_/__garden_/__path_.dir;1 ^
+__down_/__the_/__garden_/__path_       fileify 
__down_/__the_/__garden_/__path_.dir;1 ^
 __down_:[__the_.__garden_]__path_      fileify 
__down_:[__the_.__garden_]__path_.dir;1 ^
 __down_:[__the_.__garden_]__path_.     fileify ^ 
__down_:[__the_.__garden_]__path_^..dir;1 # N.B. trailing . ==> null type
 __down_:[__the_]__garden_.__path_      fileify ^ 
__down_:[__the_]__garden_^.__path_.dir;1 #undef
-/__down_/__the_/__garden_/__path_.     fileify ^ 
/__down_/__the_/__garden_/__path_. # N.B. trailing . ==> null type
-/__down_/__the_/__garden_.__path_      fileify ^ 
/__down_/__the_/__garden_.__path_
+/__down_/__the_/__garden_/__path_.     fileify ^ 
/__down_/__the_/__garden_/__path_..dir;1 # N.B. trailing . ==> null type
+/__down_/__the_/__garden_.__path_      fileify ^ 
/__down_/__the_/__garden_.__path_.dir;1
 
 # and pathifying them
 __down_:[__the_.__garden_]__path_.dir;1        pathify 
__down_:[__the_.__garden_.__path_] ^
diff --git a/vms/vms.c b/vms/vms.c
index 9d3ed12..dafb655 100644
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -5908,8 +5908,6 @@ int_fileify_dirspec(const char *dir, char *buf, int 
*utf8_fl)
     char *cp1, *cp2, *lastdir;
     char *trndir, *vmsdir;
     unsigned short int trnlnm_iter_count;
-    int is_vms = 0;
-    int is_unix = 0;
     int sts;
     if (utf8_fl != NULL)
        *utf8_fl = 0;
@@ -5992,30 +5990,6 @@ int_fileify_dirspec(const char *dir, char *buf, int 
*utf8_fl)
     cp1 = strpbrk(trndir,"]:>");
     if (hasfilename || !cp1) { /* filename present or not VMS */
 
-      if (decc_efs_charset && !cp1) {
-
-          /* EFS handling for UNIX mode */
-
-          /* Just remove the trailing '/' and we should be done */
-          STRLEN trndir_len;
-          trndir_len = strlen(trndir);
-
-          if (trndir_len > 1) {
-              trndir_len--;
-              if (trndir[trndir_len] == '/') {
-                  trndir[trndir_len] = '\0';
-              }
-          }
-          my_strlcpy(buf, trndir, VMS_MAXRSS);
-          PerlMem_free(trndir);
-          PerlMem_free(vmsdir);
-          return buf;
-      }
-
-      /* For non-EFS mode, this is left for backwards compatibility */
-      /* For EFS mode, this is only done for VMS format filespecs as */
-      /* Perl programs generally have problems when a UNIX format spec */
-      /* returns a VMS format spec */
       if (trndir[0] == '.') {
         if (trndir[1] == '\0' || (trndir[1] == '/' && trndir[2] == '\0')) {
          PerlMem_free(trndir);
@@ -6133,8 +6107,8 @@ int_fileify_dirspec(const char *dir, char *buf, int 
*utf8_fl)
                 /* The .dir for now, and fix this better later */
                 dirlen = cp2 - trndir;
             }
-            if (decc_efs_charset) {
-                /* Dots are allowed in dir names, so escape them. */
+            if (decc_efs_charset && !strchr(trndir,'/')) {
+                /* Dots are allowed in dir names, so escape them if input not 
in Unix syntax. */
                 char *cp4 = is_dir ? (cp2 - 1) : cp2;
                   
                 for (; cp4 > cp1; cp4--) {
@@ -6157,52 +6131,10 @@ int_fileify_dirspec(const char *dir, char *buf, int 
*utf8_fl)
 
       /* We've picked up everything up to the directory file name.
          Now just add the type and version, and we're set. */
-
-      /* We should only add type for VMS syntax, but historically Perl
-         has added it for UNIX style also */
-
-      /* Fix me - we should not be using the same routine for VMS and
-         UNIX format files.  Things are too tangled so we need to lookup
-         what syntax the output is */
-
-      is_unix = 0;
-      is_vms = 0;
-      lastdir = strrchr(trndir,'/');
-      if (lastdir) {
-          is_unix = 1;
-      } else {
-          lastdir = strpbrk(trndir,"]:>");
-          if (lastdir) {
-              is_vms = 1;
-          }
-      }
-
-      if ((is_vms == 0) && (is_unix == 0)) {
-          /* We still do not  know? */
-          is_unix = decc_filename_unix_report;
-          if (is_unix == 0)
-              is_vms = 1;
-      }
-
-      if ((is_unix && !decc_efs_charset) || is_vms) {
-
-           /* It is a bug to add a .dir to a UNIX format directory spec */
-           /* However Perl on VMS may have programs that expect this so */
-           /* If not using EFS character specifications allow it. */
-
-           if ((!decc_efs_case_preserve) && vms_process_case_tolerant) {
-               /* Traditionally Perl expects filenames in lower case */
-               strcat(buf, ".dir");
-           } else {
-               /* VMS expects the .DIR to be in upper case */
-               strcat(buf, ".DIR");
-           }
-
-           /* It is also a bug to put a VMS format version on a UNIX file */
-           /* specification.  Perl self tests are looking for this */
-           if (is_vms || !(decc_efs_charset || decc_filename_unix_report))
-               strcat(buf, ";1");
-      }
+      if ((!decc_efs_case_preserve) && vms_process_case_tolerant)
+          strcat(buf,".dir;1");
+      else
+          strcat(buf,".DIR;1");
       PerlMem_free(trndir);
       PerlMem_free(vmsdir);
       return buf;

--
Perl5 Master Repository

Reply via email to