develooper Front page | perl.perl5.changes | Postings from May 2008

Change 33917: Integrate:

From:
Nicholas Clark
Date:
May 23, 2008 13:45
Subject:
Change 33917: Integrate:
Change 33917 by nicholas@mouse-mill on 2008/05/23 20:43:31

	Integrate:
	[ 33911]
	Subject: [PATCH] Re: [perl #41555] Bug in File::Find on Windows when target
	From: Bram <p5p@perl.wizbit.be>
	Date: Mon, 12 May 2008 22:13:33 +0200
	Message-ID: <20080512221333.mq0283dlessws4wk@horde.wizbit.be>

Affected files ...

... //depot/maint-5.10/perl/lib/File/Find.pm#5 integrate
... //depot/maint-5.10/perl/lib/File/Find/t/find.t#2 integrate

Differences ...

==== //depot/maint-5.10/perl/lib/File/Find.pm#5 (text) ====
Index: perl/lib/File/Find.pm
--- perl/lib/File/Find.pm#4~33729~	2008-04-22 11:51:34.000000000 -0700
+++ perl/lib/File/Find.pm	2008-05-23 13:43:31.000000000 -0700
@@ -795,7 +795,7 @@
     if ($Is_MacOS) {
 	$dir_pref= ($p_dir =~ /:$/) ? $p_dir : "$p_dir:"; # preface
     } elsif ($^O eq 'MSWin32') {
-	$dir_pref = ($p_dir =~ m|\w:/$| ? $p_dir : "$p_dir/" );
+	$dir_pref = ($p_dir =~ m|\w:/?$| ? $p_dir : "$p_dir/" );
     } elsif ($^O eq 'VMS') {
 
 	#	VMS is returning trailing .dir on directories
@@ -987,7 +987,7 @@
 		$dir_pref = "$dir_name:";
 	    }
 	    elsif ($^O eq 'MSWin32') {
-		$dir_name = ($p_dir =~ m|\w:/$| ? "$p_dir$dir_rel" : "$p_dir/$dir_rel");
+		$dir_name = ($p_dir =~ m|\w:/?$| ? "$p_dir$dir_rel" : "$p_dir/$dir_rel");
 		$dir_pref = "$dir_name/";
 	    }
 	    elsif ($^O eq 'VMS') {

==== //depot/maint-5.10/perl/lib/File/Find/t/find.t#2 (text) ====
Index: perl/lib/File/Find/t/find.t
--- perl/lib/File/Find/t/find.t#1~32694~	2007-12-22 01:23:09.000000000 -0800
+++ perl/lib/File/Find/t/find.t	2008-05-23 13:43:31.000000000 -0700
@@ -18,8 +18,14 @@
     $SIG{'__WARN__'} = sub { $warn_msg = $_[0]; warn "# $_[0]"; }
 }
 
-if ( $symlink_exists ) { print "1..199\n"; }
-else                   { print "1..85\n";  }
+my $test_count = 85;
+$test_count += 114 if $symlink_exists;
+$test_count += 18 if $^O eq 'MSWin32';
+$test_count += 2 if $^O eq 'MSWin32' and $symlink_exists;
+
+print "1..$test_count\n";
+#if ( $symlink_exists ) { print "1..199\n"; }
+#else                   { print "1..85\n";  }
 
 my $orig_dir = cwd();
 
@@ -830,3 +836,60 @@
     unlink file_path('fa', 'faa_sl');
 
 }
+
+
+# Win32 checks  - [perl #41555]
+if ($^O eq 'MSWin32') {
+    require File::Spec::Win32;
+    my ($volume) = File::Spec::Win32->splitpath($orig_dir, 1);
+    print STDERR "VOLUME = $volume\n";
+    
+    # with chdir
+    %Expect_File = (File::Spec->curdir => 1,
+                    file_path('fsl') => 1,
+                    file_path('fa_ord') => 1,
+                    file_path('fab') => 1,
+                    file_path('fab_ord') => 1,
+                    file_path('faba') => 1,
+                    file_path('faba_ord') => 1,
+                    file_path('faa') => 1,
+                    file_path('faa_ord') => 1);
+
+    delete $Expect_File{ file_path('fsl') } unless $symlink_exists;
+    %Expect_Name = ();
+
+    %Expect_Dir = (dir_path('fa') => 1,
+                   dir_path('faa') => 1,
+                   dir_path('fab') => 1,
+                   dir_path('faba') => 1,
+                   dir_path('fb') => 1,
+                   dir_path('fba') => 1);
+    
+    
+    
+    File::Find::find( {wanted => \&wanted_File_Dir}, topdir('fa'));
+    Check( scalar(keys %Expect_File) == 0 );    
+    
+    # no_chdir
+    %Expect_File = ($volume . file_path_name('fa') => 1,
+                    $volume . file_path_name('fa', 'fsl') => 1,
+                    $volume . file_path_name('fa', 'fa_ord') => 1,
+                    $volume . file_path_name('fa', 'fab') => 1,
+                    $volume . file_path_name('fa', 'fab', 'fab_ord') => 1,
+                    $volume . file_path_name('fa', 'fab', 'faba') => 1,
+                    $volume . file_path_name('fa', 'fab', 'faba', 'faba_ord') => 1,
+                    $volume . file_path_name('fa', 'faa') => 1,
+                    $volume . file_path_name('fa', 'faa', 'faa_ord') => 1);
+                    
+
+    delete $Expect_File{ $volume . file_path_name('fa', 'fsl') } unless $symlink_exists;
+    %Expect_Name = ();
+
+    %Expect_Dir = ($volume . dir_path('fa') => 1,
+                   $volume . dir_path('fa', 'faa') => 1,
+                   $volume . dir_path('fa', 'fab') => 1,
+                   $volume . dir_path('fa', 'fab', 'faba') => 1);
+                   
+    File::Find::find( {wanted => \&wanted_File_Dir, no_chdir => 1}, $volume . topdir('fa'));
+    Check( scalar(keys %Expect_File) == 0 );
+}
End of Patch.



Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About