Title: RE: [EMAIL PROTECTED] [PATCH MakeMaker and File::Spec::Win32]

Orton, Yves wrote
> Tests for 5.6.2 are running right now and im just putting together my
> patches to post.
>
> Er, the tests are done. 5.6.2 passes all tests!
>
> Yah!

All tests successful, 36 tests and 229 subtests skipped.
Files=368, Tests=13714, 216 wallclock secs ( 0.00 cusr +  0.00 csys =  0.00 CPU)
        cd ..\win32

Attached and included is the patches to MakeMaker (and File::Spec::Win32) that I needed to apply to get it working.

Incidentally, im reconsidering the patch to MakeMaker.pm, I think maybe its better to patch File::Spec::Win32::filename_is_absolute() but its sort of a hard call for me.

First off, the test suite for Perl 5.6.2 spits out a bunch of uninitialized warnings that are traced back to lines 72 and 140 in File::Spec::Win32. These can be silenced by adding changing $var=~ to ($var||"")=~. (or of course changine the tests, but Ill leave that to someone elses judgement.)

Eg:

../lib/ExtUtils/t/Install...............ok
../lib/ExtUtils/t/INST_PREFIX...........ok 1/36Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32

.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 140.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 140.
../lib/ExtUtils/t/INST_PREFIX...........ok 6/36Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32

.pm line 72.
../lib/ExtUtils/t/INST_PREFIX...........ok 9/36Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32

.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 140.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 140.
../lib/ExtUtils/t/INST_PREFIX...........ok 30/36Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win3

2.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 140.
../lib/ExtUtils/t/INST_PREFIX...........ok 32/36Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win3

2.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 140.
../lib/ExtUtils/t/INST_PREFIX...........ok 34/36Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win3

2.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 140.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 140.
../lib/ExtUtils/t/INST_PREFIX...........ok
../lib/ExtUtils/t/INST..................ok 1/23Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32

.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 140.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 140.
../lib/ExtUtils/t/INST..................ok 17/23Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win3

2.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 140.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 72.
Use of uninitialized value in pattern match (m//) at ../lib/File/Spec/Win32.pm line 140.
../lib/ExtUtils/t/INST..................ok

But more importantly filename_is_absolute (here edited as I describe above) uses somewhat interesting logic:

sub file_name_is_absolute {
    my ($self,$file) = @_;
    return scalar(($file||"") =~ m{^([a-z]:)?[\\/]}is);
}

So this says the filename is absolute if it begin with a volume _and_ starts with a slash, or just starts with a slash.

I kinda wonder if a better logic would be to say its absolute if it begins with a volume or if it begins with a slash.

Anyway, besides the above point, which im sure could be argued endlessly, things look good after the below (and attached) patch is applied:

--- perl\lib\ExtUtils\MakeMaker.pm.bak  2003-09-01 21:59:58.000000000 +0200
+++ perl\lib\ExtUtils\MakeMaker.pm      2003-09-02 21:03:05.000000000 +0200
@@ -447,8 +447,12 @@
             $self->{$key} = $self->{PARENT}{$key};

             unless ($Is_VMS && $key =~ /PERL$/) {
-                $self->{$key} = $self->catdir("..",$self->{$key})
-                  unless $self->file_name_is_absolute($self->{$key});
+                unless ($self->file_name_is_absolute($self->{$key})) {
+                    # We do this because otherwise Win32 has conniptions
+                    my ($v,$p,$f)=$self->splitpath($self->{$key});
+                    $p=$self->catdir("..",$p);
+                    $self->{$key} = $self->catpath($v,$p,$f);
+                }
             } else {
                 # PERL or FULLPERL will be a command verb or even a
                 # command with an argument instead of a full file
--- perl\lib\ExtUtils\MM_Unix.pm.bak    2003-09-01 22:04:34.000000000 +0200
+++ perl\lib\ExtUtils\MM_Unix.pm        2003-09-02 20:58:48.000000000 +0200
@@ -1669,7 +1669,7 @@

 Initializes AR, AR_STATIC_ARGS, BASEEXT, CONFIG, DISTNAME, DLBASE,
 EXE_EXT, FULLEXT, FULLPERL, FULLPERLRUN, FULLPERLRUNINST, INST_*,
-INSTALL*, INSTALLDIRS, LD, LIB_EXT, LIBPERL_A, MAP_TARGET, NAME,
+INSTALL*, INSTALLDIRS, LIB_EXT, LIBPERL_A, MAP_TARGET, NAME,
 OBJ_EXT, PARENT_NAME, PERL, PERL_ARCHLIB, PERL_INC, PERL_LIB,
 PERL_SRC, PERLRUN, PERLRUNINST, PREFIX, VERSION,
 VERSION_SYM, XS_VERSION.
@@ -1870,7 +1870,7 @@
     $self->{AR_STATIC_ARGS} ||= "cr";

     # These should never be needed
-    $self->{LD} ||= 'ld';
+    #$self->{LD} ||= 'ld'; # Breaks Win32, moved to init_others()
     $self->{OBJ_EXT} ||= '.o';
     $self->{LIB_EXT} ||= '.a';

@@ -1888,7 +1888,7 @@
 =item init_others

 Initializes EXTRALIBS, BSLOADLIBS, LDLOADLIBS, LIBS, LD_RUN_PATH,
-OBJECT, BOOTDEP, PERLMAINCC, LDFROM, LINKTYPE, SHELL, NOOP,
+OBJECT, BOOTDEP, PERLMAINCC, LD, LDFROM, LINKTYPE, SHELL, NOOP,
 FIRST_MAKEFILE, MAKEFILE_OLD, NOECHO, RM_F, RM_RF, TEST_F,
 TOUCH, CP, MV, CHMOD, UMASK_NULL, ECHO, ECHO_N

@@ -1897,6 +1897,8 @@
 sub init_others {      # --- Initialize Other Attributes
     my($self) = shift;

+    $self->{LD} ||= 'ld'; # Moved here so Win32 is happy
+
     # Compute EXTRALIBS, BSLOADLIBS and LDLOADLIBS from $self->{LIBS}
     # Lets look at $self->{LIBS} carefully: It may be an anon array, a string or
     # undefined. In any case we turn it into an anon array:
--- perl\lib\file\spec\win32.pm.orig    2003-07-31 00:45:52.000000000 +0200
+++ perl\lib\file\spec\win32.pm 2003-09-02 21:32:55.000000000 +0200
@@ -69,7 +69,8 @@
 
 sub file_name_is_absolute {
     my ($self,$file) = @_;
-    return scalar($file =~ m{^([a-z]:)?[\\/]}is);
+    # || trick is safe here, if the file is 0 then its still not absolute
+    return scalar(($file||"") =~ m{^([a-z]:)?[\\/]}is);
 }
 
 =item catfile
@@ -131,10 +132,13 @@
 The results can be passed to L</catpath> to get back a path equivalent to
 (usually identical to) the original path.
 
+Will NOT throw a warning if the $path is undefined.
+
 =cut
 
 sub splitpath {
     my ($self,$path, $nofile) = @_;
+    $path="" unless defined $path;
     my ($volume,$directory,$file) = ('','','');
     if ( $nofile ) {
         $path =~

 

Attachment: perl562_win32_build.diff
Description: Binary data

Reply via email to