From 7aa86a2951adf94256343550e29973182e9b51e6 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Sun, 25 Nov 2001 21:22:10 +0000 Subject: [PATCH] For some reason CygWin wasn't collapsing multiple slashes into one, which made some Spec.t tests to fail. Either CygWin was being too prudish or the collapsing logic needs to be rethunk. p4raw-id: //depot/perl@13273 --- lib/File/Spec/Unix.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/File/Spec/Unix.pm b/lib/File/Spec/Unix.pm index 7371c57..49c522a 100644 --- a/lib/File/Spec/Unix.pm +++ b/lib/File/Spec/Unix.pm @@ -42,7 +42,12 @@ sub canonpath { if ( $^O =~ m/^(?:qnx|nto)$/ && $path =~ s:^(//[^/]+)(/|\z):/:s ) { $node = $1; } - $path =~ s|/+|/|g unless($^O eq 'cygwin'); # xx////xx -> xx/xx + # This used to be + # $path =~ s|/+|/|g unless($^O eq 'cygwin'); + # but that made tests 29, 30, 35, 46, and 213 (as of #13272) to fail + # (Mainly because trailing "" directories didn't get stripped). + # Why would cygwin avoid collapsing multiple slashes into one? --jhi + $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 -- 2.7.4