This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Escape EFS for directory portion in tovmsspec.
authorCraig A. Berry <craigberry@mac.com>
Wed, 19 Nov 2014 01:03:51 +0000 (19:03 -0600)
committerCraig A. Berry <craigberry@mac.com>
Wed, 19 Nov 2014 02:36:39 +0000 (20:36 -0600)
For some reason extended characters were only being escaped in
the final component of the path, but not in the directory portion,
the one exception being dots.  We need to give the entire path
the same treatment.  There is probably considerable opportunity
for further consolidation and refactoring in what we escape, but
at least now ../foo  bar/ correctly becomes [-.foo^_^_bar].

The reverse case has similar problems and is a TODO.

ext/VMS-Filespec/t/filespec.t
vms/vms.c

index 0f31f85..fe91ae0 100644 (file)
@@ -107,6 +107,7 @@ __some_:<__where_.__over_>__the_.__rainbow_    unixify /__some_/__where_/__over_
 __lyrics_:[__are_.__very_^.__sappy_]__but_^.__rhymes_^.__are_.__true_    unixify   /__lyrics_/__are_/__very_.__sappy_/__but_.__rhymes_.__are_.__true_ ^
 [.$(macro)]    unixify $(macro)/ ^
 ^+foo.tmp      unixify +foo.tmp ^
+[-.foo^_^_bar] unixify ../foo\ \ bar/ ^*
 
 # and back again
 /__some_/__where_/__over_/__the_.__rainbow_    vmsify  __some_:[__where_.__over_]__the_.__rainbow_ ^
@@ -131,6 +132,7 @@ __some_/__where_/...   vmsify  [.__some_.__where_...] ^
 foo-bar-0^.01/ vmsify [.foo-bar-0_01] [.foo-bar-0^.01]
 \ foo.tmp      vmsify ^_foo.tmp ^
 +foo.tmp       vmsify ^+foo.tmp ^
+../foo\ \ bar/ vmsify [-.foo^_^_bar] ^
 # 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 ^
index 4278afe..080e894 100644 (file)
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -8591,7 +8591,12 @@ static char *int_tovmsspec
          VMSEFS_DOT_WITH_ESCAPE(cp1, rslt, VMS_MAXRSS);
        }
       }
-      else                  *(cp1++) =  *cp2;
+      else {
+        int out_cnt;
+        cp2 += copy_expand_unix_filename_escape(cp1, cp2, &out_cnt, utf8_flag);
+        cp2--; /* we're in a loop that will increment this */
+        cp1 += out_cnt;
+      }
       infront = 1;
     }
   }