] VMS-only File::Spec->canonpath fix
authorCraig A. Berry <craigberry@mac.com>
Wed, 5 Dec 2001 16:41:59 +0000 (10:41 -0600)
committerJarkko Hietaniemi <jhi@iki.fi>
Thu, 6 Dec 2001 02:39:43 +0000 (02:39 +0000)
Message-Id: <5.1.0.14.2.20011205160043.02160e90@exchi01>

p4raw-id: //depot/perl@13481

README.vms
configure.com
lib/File/Spec/VMS.pm
vms/ext/filespec.t

index 6be5385..8d20758 100644 (file)
@@ -178,8 +178,6 @@ troublesome logicals and symbols are:
     T    "LOGICAL"
     FOO  "LOGICAL"
     EXT  "LOGICAL"
-    SOME_LOGICAL_NAME_NOT_LIKELY "LOGICAL"
-    DOWN_LOGICAL_NAME_NOT_LIKELY "LOGICAL"
     TEST "SYMBOL"
 
 As a handy shortcut, the command:
index 617923f..98e5867 100644 (file)
@@ -6065,8 +6065,6 @@ $ CALL Bad_environment "LIB"
 $ CALL Bad_environment "T"
 $ CALL Bad_environment "FOO"
 $ CALL Bad_environment "EXT"
-$ CALL Bad_environment "SOME_LOGICAL_NAME_NOT_LIKELY"
-$ CALL Bad_environment "DOWN_LOGICAL_NAME_NOT_LIKELY"
 $ CALL Bad_environment "TEST" "SYMBOL"
 $ IF f$search("config.msg") .eqs. "" THEN echo "OK."
 $!
index 325af08..f21ff5e 100644 (file)
@@ -157,7 +157,7 @@ sub canonpath {
     }
     else {
       $path =~ s/([\[<])000000\./$1/g;                  # [000000.foo     ==> [foo
-      $path =~ s/([^-]+)\.000000([\]\>])/$1$2/g;        # foo.000000]     ==> foo]
+      $path =~ s/([^-]+)\.(\]\[|><)?000000([\]\>])/$1$3/g;  # foo.000000] ==> foo]
       $path =~ s-\]\[--g;  $path =~ s/><//g;            # foo.][bar       ==> foo.bar
       1 while $path =~ s{([\[<-])\.-}{$1-};             # [.-.-           ==> [--
       $path =~ s/\.[^\[<\.]+\.-([\]\>])/$1/;            # bar.foo.-]      ==> bar]
index bab7288..53be634 100644 (file)
@@ -3,6 +3,7 @@
 BEGIN { unshift(@INC,'../lib') if -d '../lib'; }
 
 use VMS::Filespec;
+use File::Spec;
 
 foreach (<DATA>) {
   chomp;
@@ -44,31 +45,33 @@ ok(rmdir('testdir/'),           '    rmdir()');
 
 __DATA__
 
+# lots of underscores used to minimize collision with existing logical names
+
 # Basic VMS to Unix filespecs
-some_logical_name_not_likely:[where.over]the.rainbow   unixify /some_logical_name_not_likely/where/over/the.rainbow
-[.some_logical_name_not_likely.where.over]the.rainbow  unixify some_logical_name_not_likely/where/over/the.rainbow
-[-.some_logical_name_not_likely.where.over]the.rainbow unixify ../some_logical_name_not_likely/where/over/the.rainbow
-[.some_logical_name_not_likely.--.where.over]the.rainbow       unixify some_logical_name_not_likely/../../where/over/the.rainbow
-[.some_logical_name_not_likely...where.over]the.rainbow        unixify some_logical_name_not_likely/.../where/over/the.rainbow
-[...some_logical_name_not_likely.where.over]the.rainbow        unixify .../some_logical_name_not_likely/where/over/the.rainbow
-[.some_logical_name_not_likely.where.over...]the.rainbow       unixify some_logical_name_not_likely/where/over/.../the.rainbow
-[.some_logical_name_not_likely.where.over...]  unixify some_logical_name_not_likely/where/over/.../
-[.some_logical_name_not_likely.where.over.-]   unixify some_logical_name_not_likely/where/over/../
+__some_:[__where_.__over_]__the_.__rainbow_    unixify /__some_/__where_/__over_/__the_.__rainbow_
+[.__some_.__where_.__over_]__the_.__rainbow_   unixify __some_/__where_/__over_/__the_.__rainbow_
+[-.__some_.__where_.__over_]__the_.__rainbow_  unixify ../__some_/__where_/__over_/__the_.__rainbow_
+[.__some_.--.__where_.__over_]__the_.__rainbow_        unixify __some_/../../__where_/__over_/__the_.__rainbow_
+.__some_...__where_.__over_]__the_.__rainbow_ unixify __some_/.../__where_/__over_/__the_.__rainbow_
+[...__some_.__where_.__over_]__the_.__rainbow_ unixify .../__some_/__where_/__over_/__the_.__rainbow_
+[.__some_.__where_.__over_...]__the_.__rainbow_        unixify __some_/__where_/__over_/.../__the_.__rainbow_
+[.__some_.__where_.__over_...] unixify __some_/__where_/__over_/.../
+[.__some_.__where_.__over_.-]  unixify __some_/__where_/__over_/../
 []     unixify         ./
 [-]    unixify         ../
 [--]   unixify         ../../
 [...]  unixify         .../
 
 # and back again
-/some_logical_name_not_likely/where/over/the.rainbow   vmsify  some_logical_name_not_likely:[where.over]the.rainbow
-some_logical_name_not_likely/where/over/the.rainbow    vmsify  [.some_logical_name_not_likely.where.over]the.rainbow
-../some_logical_name_not_likely/where/over/the.rainbow vmsify  [-.some_logical_name_not_likely.where.over]the.rainbow
-some_logical_name_not_likely/../../where/over/the.rainbow      vmsify  [-.where.over]the.rainbow
-.../some_logical_name_not_likely/where/over/the.rainbow        vmsify  [...some_logical_name_not_likely.where.over]the.rainbow
-some_logical_name_not_likely/.../where/over/the.rainbow        vmsify  [.some_logical_name_not_likely...where.over]the.rainbow
-/some_logical_name_not_likely/.../where/over/the.rainbow       vmsify  some_logical_name_not_likely:[...where.over]the.rainbow
-some_logical_name_not_likely/where/... vmsify  [.some_logical_name_not_likely.where...]
-/where/...     vmsify  where:[...]
+/__some_/__where_/__over_/__the_.__rainbow_    vmsify  __some_:[__where_.__over_]__the_.__rainbow_
+__some_/__where_/__over_/__the_.__rainbow_     vmsify  [.__some_.__where_.__over_]__the_.__rainbow_
+../__some_/__where_/__over_/__the_.__rainbow_  vmsify  [-.__some_.__where_.__over_]__the_.__rainbow_
+__some_/../../__where_/__over_/__the_.__rainbow_       vmsify  [-.__where_.__over_]__the_.__rainbow_
+.../__some_/__where_/__over_/__the_.__rainbow_ vmsify  [...__some_.__where_.__over_]__the_.__rainbow_
+__some_/.../__where_/__over_/__the_.__rainbow_ vmsify  [.__some_...__where_.__over_]__the_.__rainbow_
+/__some_/.../__where_/__over_/__the_.__rainbow_        vmsify  __some_:[...__where_.__over_]__the_.__rainbow_
+__some_/__where_/...   vmsify  [.__some_.__where_...]
+/__where_/...  vmsify  __where_:[...]
 .      vmsify  []
 ..     vmsify  [-]
 ../..  vmsify  [--]
@@ -76,48 +79,52 @@ some_logical_name_not_likely/where/...      vmsify  [.some_logical_name_not_likely.whe
 /      vmsify  sys$disk:[000000]
 
 # Fileifying directory specs
-down_logical_name_not_likely:[the.garden.path] fileify down_logical_name_not_likely:[the.garden]path.dir;1
-[.down_logical_name_not_likely.the.garden.path]        fileify [.down_logical_name_not_likely.the.garden]path.dir;1
-/down_logical_name_not_likely/the/garden/path  fileify /down_logical_name_not_likely/the/garden/path.dir;1
-/down_logical_name_not_likely/the/garden/path/ fileify /down_logical_name_not_likely/the/garden/path.dir;1
-down_logical_name_not_likely/the/garden/path   fileify down_logical_name_not_likely/the/garden/path.dir;1
-down_logical_name_not_likely:[the.garden]path  fileify down_logical_name_not_likely:[the.garden]path.dir;1
-down_logical_name_not_likely:[the.garden]path. fileify # N.B. trailing . ==> null type
-down_logical_name_not_likely:[the]garden.path  fileify 
-/down_logical_name_not_likely/the/garden/path. fileify # N.B. trailing . ==> null type
-/down_logical_name_not_likely/the/garden.path  fileify 
+__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
+__down_:[__the_.__garden_]__path_      fileify __down_:[__the_.__garden_]__path_.dir;1
+__down_:[__the_.__garden_]__path_.     fileify # N.B. trailing . ==> null type
+__down_:[__the_]__garden_.__path_      fileify 
+/__down_/__the_/__garden_/__path_.     fileify # N.B. trailing . ==> null type
+/__down_/__the_/__garden_.__path_      fileify 
 
 # and pathifying them
-down_logical_name_not_likely:[the.garden]path.dir;1    pathify down_logical_name_not_likely:[the.garden.path]
-[.down_logical_name_not_likely.the.garden]path.dir     pathify [.down_logical_name_not_likely.the.garden.path]
-/down_logical_name_not_likely/the/garden/path.dir      pathify /down_logical_name_not_likely/the/garden/path/
-down_logical_name_not_likely/the/garden/path.dir       pathify down_logical_name_not_likely/the/garden/path/
-down_logical_name_not_likely:[the.garden]path  pathify down_logical_name_not_likely:[the.garden.path]
-down_logical_name_not_likely:[the.garden]path. pathify # N.B. trailing . ==> null type
-down_logical_name_not_likely:[the]garden.path  pathify 
-/down_logical_name_not_likely/the/garden/path. pathify # N.B. trailing . ==> null type
-/down_logical_name_not_likely/the/garden.path  pathify 
-down_logical_name_not_likely:[the.garden]path.dir;2    pathify #N.B. ;2
-__path pathify __path/
-/down_logical_name_not_likely/the/garden/.     pathify /down_logical_name_not_likely/the/garden/./
-/down_logical_name_not_likely/the/garden/..    pathify /down_logical_name_not_likely/the/garden/../
-/down_logical_name_not_likely/the/garden/...   pathify /down_logical_name_not_likely/the/garden/.../
-path.notdir    pathify 
+__down_:[__the_.__garden_]__path_.dir;1        pathify __down_:[__the_.__garden_.__path_]
+[.__down_.__the_.__garden_]__path_.dir pathify [.__down_.__the_.__garden_.__path_]
+/__down_/__the_/__garden_/__path_.dir  pathify /__down_/__the_/__garden_/__path_/
+__down_/__the_/__garden_/__path_.dir   pathify __down_/__the_/__garden_/__path_/
+__down_:[__the_.__garden_]__path_      pathify __down_:[__the_.__garden_.__path_]
+__down_:[__the_.__garden_]__path_.     pathify # N.B. trailing . ==> null type
+__down_:[__the_]__garden_.__path_      pathify 
+/__down_/__the_/__garden_/__path_.     pathify # N.B. trailing . ==> null type
+/__down_/__the_/__garden_.__path_      pathify 
+__down_:[__the_.__garden_]__path_.dir;2        pathify #N.B. ;2
+__path_        pathify __path_/
+/__down_/__the_/__garden_/.    pathify /__down_/__the_/__garden_/./
+/__down_/__the_/__garden_/..   pathify /__down_/__the_/__garden_/../
+/__down_/__the_/__garden_/...  pathify /__down_/__the_/__garden_/.../
+__path_.notdir pathify 
 
 # Both VMS/Unix and file/path conversions
-down_logical_name_not_likely:[the.garden]path.dir;1    unixpath        /down_logical_name_not_likely/the/garden/path/
-/down_logical_name_not_likely/the/garden/path  vmspath down_logical_name_not_likely:[the.garden.path]
-down_logical_name_not_likely:[the.garden.path] unixpath        /down_logical_name_not_likely/the/garden/path/
-down_logical_name_not_likely:[the.garden.path...]      unixpath        /down_logical_name_not_likely/the/garden/path/.../
-/down_logical_name_not_likely/the/garden/path.dir      vmspath down_logical_name_not_likely:[the.garden.path]
-[.down_logical_name_not_likely.the.garden]path.dir     unixpath        down_logical_name_not_likely/the/garden/path/
-down_logical_name_not_likely/the/garden/path   vmspath [.down_logical_name_not_likely.the.garden.path]
-__path vmspath [.__path]
+__down_:[__the_.__garden_]__path_.dir;1        unixpath        /__down_/__the_/__garden_/__path_/
+/__down_/__the_/__garden_/__path_      vmspath __down_:[__the_.__garden_.__path_]
+__down_:[__the_.__garden_.__path_]     unixpath        /__down_/__the_/__garden_/__path_/
+__down_:[__the_.__garden_.__path_...]  unixpath        /__down_/__the_/__garden_/__path_/.../
+/__down_/__the_/__garden_/__path_.dir  vmspath __down_:[__the_.__garden_.__path_]
+[.__down_.__the_.__garden_]__path_.dir unixpath        __down_/__the_/__garden_/__path_/
+__down_/__the_/__garden_/__path_       vmspath [.__down_.__the_.__garden_.__path_]
+__path_        vmspath [.__path_]
 /      vmspath sys$disk:[000000]
 
 # Redundant characters in Unix paths
-//some_logical_name_not_likely/where//over/../the.rainbow      vmsify  some_logical_name_not_likely:[where]the.rainbow
-/some_logical_name_not_likely/where//over/./the.rainbow        vmsify  some_logical_name_not_likely:[where.over]the.rainbow
+//__some_/__where_//__over_/../__the_.__rainbow_       vmsify  __some_:[__where_]__the_.__rainbow_
+/__some_/__where_//__over_/./__the_.__rainbow_ vmsify  __some_:[__where_.__over_]__the_.__rainbow_
 ..//../        vmspath [--]
 ./././ vmspath []
 ./../. vmsify  [-]
+
+# Our override of File::Spec->canonpath can do some strange things
+__dev:[__dir.000000]__foo     File::Spec->canonpath   __dev:[__dir]__foo
+__dev:[__dir.][000000]__foo   File::Spec->canonpath   __dev:[__dir]__foo