delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/07/21/03:16:58

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Thu, 21 Jul 2005 00:14:51 -0700
From: Michael G Schwern <schwern AT pobox DOT com>
To: Andrew Ho <andrew AT tellme DOT com>
Cc: Scott Bolte <listS+cygwin AT niss DOT com>,
"Gerrit P. Haase" <gerrit AT familiehaase DOT de>, cygwin AT cygwin DOT com,
makemaker AT perl DOT org, perl5-porters AT perl DOT org, petdance AT cpan DOT org
Subject: Re: [perl-5.8.7] Perl regression tests fail when lib directory is present
Message-ID: <20050721071451.GB23209@windhund.schwern.org>
References: <200507200216 DOT j6K2G3IL011560 AT crag DOT niss DOT com> <20050720180419 DOT GA16999 AT windhund DOT schwern DOT org> <Pine DOT GSO DOT 4 DOT 62 DOT 0507201851210 DOT 18081 AT shell02 DOT corp DOT tellme DOT com>
Mime-Version: 1.0
In-Reply-To: <Pine.GSO.4.62.0507201851210.18081@shell02.corp.tellme.com>
User-Agent: Mutt/1.4.2.1i

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 AT pobox DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019