summaryrefslogtreecommitdiff
path: root/lib/File/Spec/Unix.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/File/Spec/Unix.pm')
-rw-r--r--lib/File/Spec/Unix.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/File/Spec/Unix.pm b/lib/File/Spec/Unix.pm
index 00899e71d6..ae2a94937d 100644
--- a/lib/File/Spec/Unix.pm
+++ b/lib/File/Spec/Unix.pm
@@ -26,7 +26,7 @@ Methods for manipulating file specifications.
=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 @@ sub canonpath {
$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