Change 11675 by jhi@alpha on 2001/08/15 03:28:20

        Subject: Re: bug in File::Spec 0.82 (canonpath)
        From: Barrie Slaymaker <[EMAIL PROTECTED]>
        Date: Tue, 14 Aug 2001 14:32:25 -0400
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

... //depot/perl/lib/File/Spec.t#2 edit
... //depot/perl/lib/File/Spec/Unix.pm#20 edit

Differences ...

==== //depot/perl/lib/File/Spec.t#2 (xtext) ====
Index: perl/lib/File/Spec.t
--- perl/lib/File/Spec.t.~1~    Tue Aug 14 21:45:05 2001
+++ perl/lib/File/Spec.t        Tue Aug 14 21:45:05 2001
@@ -53,7 +53,10 @@
 
 [ "Unix->canonpath('')",                                      ''          ],
 [ "Unix->canonpath('///../../..//./././a//b/.././c/././')",   '/a/b/../c' ],
-[ "Unix->canonpath('/.')",                                    '/.'        ],
+[ "Unix->canonpath('/.')",                                    '/'         ],
+[ "Unix->canonpath('/./')",                                   '/'         ],
+[ "Unix->canonpath('/a/./')",                                 '/a'        ],
+[ "Unix->canonpath('/a/.')",                                  '/a'        ],
 
 [  "Unix->abs2rel('/t1/t2/t3','/t1/t2/t3')",          ''                   ],
 [  "Unix->abs2rel('/t1/t2/t4','/t1/t2/t3')",          '../t4'              ],
@@ -63,7 +66,7 @@
 #[ "Unix->abs2rel('../t4','/t1/t2/t3')",              '../t4'              ],
 [  "Unix->abs2rel('/','/t1/t2/t3')",                  '../../..'           ],
 [  "Unix->abs2rel('///','/t1/t2/t3')",                '../../..'           ],
-[  "Unix->abs2rel('/.','/t1/t2/t3')",                 '../../../.'         ],
+[  "Unix->abs2rel('/.','/t1/t2/t3')",                 '../../..'           ],
 [  "Unix->abs2rel('/./','/t1/t2/t3')",                '../../..'           ],
 #[ "Unix->abs2rel('../t4','/t1/t2/t3')",              '../t4'              ],
 

==== //depot/perl/lib/File/Spec/Unix.pm#20 (text) ====
Index: perl/lib/File/Spec/Unix.pm
--- perl/lib/File/Spec/Unix.pm.~1~      Tue Aug 14 21:45:05 2001
+++ perl/lib/File/Spec/Unix.pm  Tue Aug 14 21:45:05 2001
@@ -26,7 +26,7 @@
 =item canonpath
 
 No physical check on the filesystem, but a logical cleanup of a
-path. On UNIX eliminated successive slashes and successive "/.".
+path. On UNIX eliminate successive slashes and successive "/.".
 
     $cpath = File::Spec->canonpath( $path ) ;
 
@@ -41,7 +41,7 @@
       $node = $1;
     }
     $path =~ s|/+|/|g unless($^O eq 'cygwin');     # xx////xx  -> xx/xx
-    $path =~ s|(/\.)+/|/|g;                        # xx/././xx -> xx/xx
+    $path =~ s@(/\.)+(/|\Z(?!\n))@/@g;             # xx/././xx -> xx/xx
     $path =~ s|^(\./)+||s unless $path eq "./";    # ./xx      -> xx
     $path =~ s|^/(\.\./)+|/|s;                     # /../../xx -> xx
     $path =~ s|/\Z(?!\n)|| unless $path eq "/";          # xx/       -> xx
End of Patch.

Reply via email to