Tue Jan 05 01:59:53 2010: Request 52794 was acted upon. Transaction: Correspondence added by CHOCOLATE Queue: PAR-Packer Subject: Multiple tests failing on strawberry perl Broken in: 1.001 Severity: (no value) Owner: Nobody Requestors: javier...@gmail.com Status: open Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=52794 >
I have the same problem on Strawberry Perl 5.10.1.0. The problem occurs in the "require PAR::Filter::PodStrip" statement in script/par.pl's require_modules() sub. It arises because par_init_env (inside myldr/utils.c), which is called in a BEGIN block in script/par.pl, clears several environment variables, including $ENV{PERL5LIB}. This breaks the two tests that try to pass down blib/lib to child processes through $PERL5LIB. I've attached a patch. It modifies script/par.pl and the two tests. The patched script/par.pl tests for an additional env var, PAR_PACKER_TEST_INC, that is only set in the test scripts, and extracts and uses it (i.e. prepends it to @INC) if it's defined.
diff -uwbr PAR-Packer-orig/script/par.pl PAR-Packer-new/script/par.pl --- PAR-Packer-orig/script/par.pl 2009-09-13 16:13:47.000000000 +0100 +++ PAR-Packer-new/script/par.pl 2010-01-05 06:30:42.000000000 +0000 @@ -937,6 +937,11 @@ } sub init_inc { + # fix for rt #52794 + if (defined $ENV{PAR_PACKER_TEST_INC}) { + push @INC, $ENV{PAR_PACKER_TEST_INC}; + } + require Config; push @INC, grep defined, map $Config::Config{$_}, qw( archlibexp privlibexp sitearchexp sitelibexp diff -uwbr PAR-Packer-orig/t/20-pp.t PAR-Packer-new/t/20-pp.t --- PAR-Packer-orig/t/20-pp.t 2009-09-13 16:13:47.000000000 +0100 +++ PAR-Packer-new/t/20-pp.t 2010-01-05 06:28:14.000000000 +0000 @@ -81,6 +81,11 @@ $ENV{PERL5LIB}, ); +# rt #52794 +# script/par.pl calls Internals::PAR::_par_init_env, which unsets $ENV{PERL5LIB}, +# which clobbers the blib/lib path. Pass it in via a test-specific env var instead. +$ENV{PAR_PACKER_TEST_INC} = File::Spec->catdir($cwd, 'blib', 'lib'); + chdir $test_dir; do "automated_pp_test.pl"; diff -uwbr PAR-Packer-orig/t/30-current_exec.t PAR-Packer-new/t/30-current_exec.t --- PAR-Packer-orig/t/30-current_exec.t 2009-09-13 16:13:47.000000000 +0100 +++ PAR-Packer-new/t/30-current_exec.t 2010-01-05 06:29:40.000000000 +0000 @@ -21,10 +21,12 @@ my $sep = $Config{path_sep}; $sep = ':' if not defined $sep; -$blib_lib .= $sep if $ENV{PERL5LIB}; -$ENV{PERL5LIB} = defined($ENV{PERL5LIB}) ? $blib_lib . $ENV{PERL5LIB} : $blib_lib; - +$ENV{PERL5LIB} = defined($ENV{PERL5LIB}) ? $blib_lib . $sep . $ENV{PERL5LIB} : $blib_lib; +# rt #52794 +# script/par.pl calls Internals::PAR::_par_init_env, which unsets $ENV{PERL5LIB}, +# which clobbers the blib/lib path. Pass it in via a test-specific env var instead. +$ENV{PAR_PACKER_TEST_INC} = $blib_lib; #### unlink $EXEC if -f $EXEC;