Change 17828 by [EMAIL PROTECTED] on 2002/09/04 11:31:42

        Subject: [PATCH] File::Spec->catfile not canonicalizing consistently
        From: Michael G Schwern <[EMAIL PROTECTED]>
        Date: Fri, 30 Aug 2002 03:40:45 -0700
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

.... //depot/perl/lib/File/Spec/Unix.pm#32 edit
.... //depot/perl/lib/File/Spec/Win32.pm#25 edit
.... //depot/perl/lib/File/Spec/t/Spec.t#3 edit

Differences ...

==== //depot/perl/lib/File/Spec/Unix.pm#32 (text) ====
Index: perl/lib/File/Spec/Unix.pm
--- perl/lib/File/Spec/Unix.pm#31~17444~        Tue Jul  9 08:50:45 2002
+++ perl/lib/File/Spec/Unix.pm  Wed Sep  4 04:31:42 2002
@@ -88,7 +88,7 @@
 
 sub catfile {
     my $self = shift;
-    my $file = pop @_;
+    my $file = File::Spec->canonpath(pop @_);
     return $file unless @_;
     my $dir = $self->catdir(@_);
     $dir .= "/" unless substr($dir,-1) eq "/";

==== //depot/perl/lib/File/Spec/Win32.pm#25 (text) ====
Index: perl/lib/File/Spec/Win32.pm
--- perl/lib/File/Spec/Win32.pm#24~17297~       Wed Jun 19 05:33:04 2002
+++ perl/lib/File/Spec/Win32.pm Wed Sep  4 04:31:42 2002
@@ -95,7 +95,7 @@
 
 sub catfile {
     my $self = shift;
-    my $file = pop @_;
+    my $file = $self->canonpath(pop @_);
     return $file unless @_;
     my $dir = $self->catdir(@_);
     $dir .= "\\" unless substr($dir,-1) eq "\\";

==== //depot/perl/lib/File/Spec/t/Spec.t#3 (text) ====
Index: perl/lib/File/Spec/t/Spec.t
--- perl/lib/File/Spec/t/Spec.t#2~16942~        Fri May 31 14:42:12 2002
+++ perl/lib/File/Spec/t/Spec.t Wed Sep  4 04:31:42 2002
@@ -50,7 +50,11 @@
 @tests = (
 # [ Function          ,            Expected          ,         Platform ]
 
-[ "Unix->catfile('a','b','c')", 'a/b/c'  ],
+[ "Unix->catfile('a','b','c')",         'a/b/c'  ],
+[ "Unix->catfile('a','b','./c')",       'a/b/c'  ],
+[ "Unix->catfile('./a','b','c')",       'a/b/c'  ],
+[ "Unix->catfile('c')",                 'c' ],
+[ "Unix->catfile('./c')",               'c' ],
 
 [ "Unix->splitpath('file')",            ',,file'            ],
 [ "Unix->splitpath('/d1/d2/d3/')",      ',/d1/d2/d3/,'      ],
@@ -87,8 +91,6 @@
 [ "Unix->catdir('','d1','d2','d3')",    '/d1/d2/d3' ],
 [ "Unix->catdir('d1','d2','d3')",       'd1/d2/d3'  ],
 
-[ "Unix->catfile('a','b','c')", 'a/b/c' ],
-
 [ "Unix->canonpath('')",                                      ''          ],
 [ "Unix->canonpath('///../../..//./././a//b/.././c/././')",   '/a/b/../c' ],
 [ "Unix->canonpath('/.')",                                    '/'         ],
@@ -184,7 +186,12 @@
 [ "Win32->catdir('A:/d1','B:/d2','d3','')", 'A:\\d1\\B:\\d2\\d3' ],
 [ "Win32->catdir('A:/')",                   'A:\\'               ],
 
-[ "Win32->catfile('a','b','c')", 'a\\b\\c' ],
+[ "Win32->catfile('a','b','c')",        'a\\b\\c' ],
+[ "Win32->catfile('a','b','.\\c')",      'a\\b\\c'  ],
+[ "Win32->catfile('.\\a','b','c')",      'a\\b\\c'  ],
+[ "Win32->catfile('c')",                'c' ],
+[ "Win32->catfile('.\\c')",              'c' ],
+
 
 [ "Win32->canonpath('')",               ''                    ],
 [ "Win32->canonpath('a:')",             'A:'                  ],
@@ -226,6 +233,13 @@
 [ "Win32->rel2abs('temp','//prague_main/work')",        '\\\\prague_main\\work\\temp' 
    ],
 [ "Win32->rel2abs('../','//prague_main/work')",         '\\\\prague_main\\work\\..'   
    ],
 
+
+[ "VMS->catfile('a','b','c')",         '[.a.b]c'  ],
+[ "VMS->catfile('a','b','[]c')",       '[.a.b]c'  ],
+[ "VMS->catfile('[.a]','b','c')",       '[.a.b]c'  ],
+[ "VMS->catfile('c')",                 'c' ],
+[ "VMS->catfile('[]c')",               'c' ],
+
 [ "VMS->splitpath('file')",                                       ',,file'            
                       ],
 [ "VMS->splitpath('[d1.d2.d3]')",                                 ',[d1.d2.d3],'      
                         ],
 [ "VMS->splitpath('[.d1.d2.d3]')",                                ',[.d1.d2.d3],'     
                         ],
@@ -294,7 +308,12 @@
 [ "VMS->rel2abs('[t1]','[t1.t2.t3]')",           '[t1]'             ],
 
 [ "OS2->catdir('A:/d1','B:/d2','d3','')", 'A:/d1/B:/d2/d3' ],
+
 [ "OS2->catfile('a','b','c')",            'a/b/c'          ],
+[ "OS2->catfile('a','b','./c')",          'a/b/c'  ],
+[ "OS2->catfile('./a','b','c')",          'a/b/c'  ],
+[ "OS2->catfile('c')",                    'c' ],
+[ "OS2->catfile('./c')",                  'c' ],
 
 
 [ "Mac->catpath('','','')",              ''                ],
End of Patch.

Reply via email to