MM_Unix::canonpath erroneously turns leading // into /
Dominic Dunlop [Thu, 10 Sep 1998 11:02:46 +0000 (11:02 +0000)]
Message-Id: <v03110703b21d581d7ef1@[212.24.192.107]>

p4raw-id: //depot/perl@1885

lib/ExtUtils/MM_Unix.pm

index 1b2e354..5f93fbc 100644 (file)
@@ -84,10 +84,10 @@ sub canonpath {
     if ( $^O eq 'qnx' && $path =~ s|^(//\d+)/|/| ) {
       $node = $1;
     }
-    $path =~ s|/+|/|g ;                            # xx////xx  -> xx/xx
+    $path =~ s|(?<=[^/])/+|/|g ;                   # xx////xx  -> xx/xx
     $path =~ s|(/\.)+/|/|g ;                       # xx/././xx -> xx/xx
     $path =~ s|^(\./)+|| unless $path eq "./";     # ./xx      -> xx
-    $path =~ s|/$|| unless $path eq "/";           # xx/       -> xx
+    $path =~ s|(?<=[^/])/$|| ;                     # xx/       -> xx
     "$node$path";
 }