From: Jarkko Hietaniemi Date: Sun, 25 Nov 2001 21:22:10 +0000 (+0000) Subject: For some reason CygWin wasn't collapsing multiple X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7aa86a2951adf94256343550e29973182e9b51e6;p=p5sagit%2Fp5-mst-13.2.git 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 --- 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