Change 31371 by [EMAIL PROTECTED] on 2007/06/13 17:12:21

        Fix random failures in CPANPLUS tests on Win32
        
        The failures were a result of calling Win32::GetShortPathName with
        the program argument " /nologo" appended to the path. Program
        arguments should not be passed to Win32::GetShortPathName.
        
        (The randomness occurred because random garbage was being produced
        due to a separate bug in that Win32 function, for which a fix is
        forthcoming...).

Affected files ...

... //depot/perl/lib/CPANPLUS/Config.pm#5 edit

Differences ...

==== //depot/perl/lib/CPANPLUS/Config.pm#5 (text) ====
Index: perl/lib/CPANPLUS/Config.pm
--- perl/lib/CPANPLUS/Config.pm#4~31292~        2007-05-28 06:17:54.000000000 
-0700
+++ perl/lib/CPANPLUS/Config.pm 2007-06-13 10:12:21.000000000 -0700
@@ -622,9 +622,30 @@
     ### clean up paths if we are on win32
     if( $^O eq 'MSWin32' ) {
         for my $pgm ( $self->program->ls_accessors ) {
-            $self->program->$pgm(
-                Win32::GetShortPathName( $self->program->$pgm )
-            ) if $self->program->$pgm and $self->program->$pgm =~ /\s+/;      
+            my $path = $self->program->$pgm;
+
+            ### paths with whitespace needs to be shortened
+            ### for shell outs.
+            if ($path and $path =~ /\s+/) {
+                my($prog, $args);
+
+                ### patch from Steve Hay, 13nd of June 2007
+                ### msg-id: <[EMAIL PROTECTED]>
+                ### windows directories are not allowed to end with 
+                ### a space, so any occurrence of '\w\s+/\w+' means
+                ### we're dealing with arguments, not directory
+                ### names.
+                if ($path =~ /^(.*?)(\s+\/.*$)/) {
+                    ($prog, $args) = ($1, $2);
+                
+                ### otherwise, there are no arguments
+                } else {
+                    ($prog, $args) = ($path, '');
+                }
+                
+                $prog = Win32::GetShortPathName( $prog );
+                $self->program->$pgm( $prog . $args );
+            }
         }
     }
 
End of Patch.

Reply via email to