This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [perl-5.8.7] Perl regression tests fail when lib directory is present


On Wed, Jul 20, 2005 at 06:54:13PM -0700, Andrew Ho wrote:
> Here are the diffs between 2.42 and 2.44, the next most recent version:
> 
>     http://www.zeuscat.com/tmp/test_harness_diff.txt
>     http://www.zeuscat.com/tmp/test_harness_diff.html (colorized)
> 
> I haven't peeked through the diff yet to figure out what the cuplrit is.

DING DING DING DING!

@@ -446,9 +464,21 @@
 	s/[\\\/+]$// foreach @inc;
     }
 
-    my %dupes;
-    @inc = grep !$dupes{$_}++, @inc;
+    my %seen;
+    $seen{$_}++ foreach $self->_default_inc();
+    @inc = grep !$seen{$_}++, @inc;
+
+    return @inc;
+}
+
+
+sub _default_inc {
+    my $self = shift;
 
+    local $ENV{PERL5LIB};
+    my $perl = $self->_command;
+    my @inc =`$perl -le "print join qq[\n], \@INC"`;
+    chomp @inc;
     return @inc;
 }
 
Its gotta be something about _default_inc().  Nothing looks wrong from
here.  My only guess is that local $ENV{PERL5LIB} is ineffective.  That
would account for the alternation.

The algorithm is this.  Test::Harness has to make sure it runs tests with
the same @INC Test::Harness ran with.  To do this it could just shove all of
@INC into PERL5LIB before running the test but there's various reasons why
this is a bad idea.  So it only puts into PERL5LIB that which perl does not
already have in its @INC by default.

_default_inc() figures out what the normal Perl @INC is without any -Is or 
PERL5LIB by localizing PERL5LIB (thus temporarily clearing it) and running 
the shell command:

	perl -le "print join qq[\n], @INC"

to get perl to list its pristine @INC.  I think the localization of PERL5LIB
is failing.  This means blib/lib is still on it and it thinks its part of
the default so it strips it off.  Next time around its not there so it puts
it back on.  And so on.

Try printing out the value of $ENV{PERL5LIB} before and after the localization
inside _default_inc().  Finally, see what _default_inc returns.

sub _default_inc {
    my $self = shift;

    print STDERR "P5LIB Before: $ENV{PERL5LIB}\n";
    local $ENV{PERL5LIB};
    print STDERR "P5LIB After:  $ENV{PERL5LIB}\n";

    my $perl = $self->_command;
    my @inc =`$perl -le "print join qq[\\n], \@INC"`;
    chomp @inc;

    print STDERR "Default @INC: @inc\n";
    return @inc;
}

And then try changing "local $ENV{PERL5LIB}" to "local $ENV{PERL5LIB} = ''".


-- 
Michael G Schwern     schwern@pobox.com     http://www.pobox.com/~schwern
Reality is that which, when you stop believing in it, doesn't go away.
	-- Phillip K. Dick

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]