This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Trim directory extension in pathify under EFS.
authorCraig A. Berry <craigberry@mac.com>
Sat, 28 Jan 2012 23:05:35 +0000 (17:05 -0600)
committerCraig A. Berry <craigberry@mac.com>
Sat, 28 Jan 2012 23:15:18 +0000 (17:15 -0600)
When Extened Filename Syntax (EFS) is in effect, 1fe570cc5e24ee
changed the age-old behavior of trimming the directory extension
off a directory filename when the path is in Unix syntax.  EFS
really has nothing to do with the necessity to trim .DIR;1 from
the name, so remove the conditional check for EFS from the
existing code.

This gets three more tests passing under EFS in vms/ext/filespec.t.

vms/vms.c

index dafb655..2a989c8 100644 (file)
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -6692,61 +6692,51 @@ static char *int_pathify_dirspec(const char *dir, char *buf)
         return ret_spec;
 
     } else {
         return ret_spec;
 
     } else {
-        /* Unix specification, Could be trivial conversion */
-        STRLEN dir_len;
-        dir_len = strlen(trndir);
+        /* Unix specification, Could be trivial conversion, */
+        /* but have to deal with trailing '.dir' or extra '.' */
 
 
-        /* If the extended file character set is in effect */
-        /* then pathify is simple */
-
-        if (!decc_efs_charset) {
-            /* Have to deal with trailing '.dir' or extra '.' */
-            /* that should not be there in legacy mode, but is */
-
-            char * lastdot;
-            char * lastslash;
-            int is_dir;
-
-            lastslash = strrchr(trndir, '/');
-            if (lastslash == NULL)
-                lastslash = trndir;
-            else
-                lastslash++;
-
-            lastdot = NULL;
+        char * lastdot;
+        char * lastslash;
+        int is_dir;
+        STRLEN dir_len = strlen(trndir);
 
 
-            /* '..' or '.' are valid directory components */
-            is_dir = 0;
-            if (lastslash[0] == '.') {
-                if (lastslash[1] == '\0') {
-                   is_dir = 1;
-                } else if (lastslash[1] == '.') {
-                    if (lastslash[2] == '\0') {
+        lastslash = strrchr(trndir, '/');
+        if (lastslash == NULL)
+            lastslash = trndir;
+        else
+            lastslash++;
+
+        lastdot = NULL;
+
+        /* '..' or '.' are valid directory components */
+        is_dir = 0;
+        if (lastslash[0] == '.') {
+            if (lastslash[1] == '\0') {
+               is_dir = 1;
+            } else if (lastslash[1] == '.') {
+                if (lastslash[2] == '\0') {
+                    is_dir = 1;
+                } else {
+                    /* And finally allow '...' */
+                    if ((lastslash[2] == '.') && (lastslash[3] == '\0')) {
                         is_dir = 1;
                         is_dir = 1;
-                    } else {
-                        /* And finally allow '...' */
-                        if ((lastslash[2] == '.') && (lastslash[3] == '\0')) {
-                            is_dir = 1;
-                        }
                     }
                 }
             }
                     }
                 }
             }
+        }
 
 
-            if (!is_dir) {
-               lastdot = strrchr(lastslash, '.');
-            }
-            if (lastdot != NULL) {
-                STRLEN e_len;
-
-                /* '.dir' is discarded, and any other '.' is invalid */
-                e_len = strlen(lastdot);
-
-                is_dir = is_dir_ext(lastdot, e_len, NULL, 0);
+        if (!is_dir) {
+           lastdot = strrchr(lastslash, '.');
+        }
+        if (lastdot != NULL) {
+            STRLEN e_len;
+             /* '.dir' is discarded, and any other '.' is invalid */
+            e_len = strlen(lastdot);
 
 
-                if (is_dir) {
-                    dir_len = dir_len - 4;
+            is_dir = is_dir_ext(lastdot, e_len, NULL, 0);
 
 
-                }
+            if (is_dir) {
+                dir_len = dir_len - 4;
             }
         }
 
             }
         }