Le 2012-02-28 20:07:58, DBARTLE a écrit :
Show quoted text> Can you post a dump of ENV at the beginning of testcover::run()? and
> also what your ENV looks
> like before you run ./Build. I want to try and replicate what is
> happening and also still let the
> automated testing sandboxes to be able to work as well so that it
> works in all cases.
I have added the following lines at the beginning of testcover::run:
foreach my $e ('PATH', sort grep(/^PERL/, keys %ENV) ) {
Test::More::diag("$e=$ENV{$e}");
}
Test::More::diag("Devel::Cover::Inc::Base=$Devel::Cover::Inc::Base");
Test::More::diag('Devel::Cover::Inc::Inc='.join(':',
@Devel::Cover::Inc::Inc));
Here is the output of "LANG=C perl -Ilib t/basic.t":
----------8<----------8<----------8<----------8<----------8<----------
#
PATH=/home/omengue/bin:/home/omengue/.perl/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
#
PERL5LIB=/home/omengue/.perl/lib/perl5/x86_64-linux-gnu-thread-multi:/home/omengue/.perl/lib/perl5
# PERLBREW_ROOT=/home/omengue/.perl/perlbrew
# PERL_CPANM_OPT=-l /home/omengue/.perl --mirror
http://distrib-coffee.ipsl.jussieu.fr/pub/mirrors/cpan/
# PERL_LOCAL_LIB_ROOT=/home/omengue/.perl
# PERL_MB_OPT=--install_base /home/omengue/.perl
# PERL_MM_OPT=INSTALL_BASE=/home/omengue/.perl
#
Devel::Cover::Inc::Base=/home/omengue/.local/share/.cpan/build/Devel-Cover-0.79-KikcpK
#
Devel::Cover::Inc::Inc=.:/etc/perl:/home/omengue/.perl/lib/perl5:/home/omengue/.perl/lib/perl5/x86_64-linux-gnu-thread-multi:/tmp/CPAN-Reporter-lib-qS3j:/usr/lib/perl/5.10.1:/usr/lib/perl5:/usr/share/perl/5.10.1:/usr/share/perl5
Can't open perl script "cover": No such file or directory
system('/usr/bin/perl','cover','/home/omengue/tmp/p5-Devel-Cover-Report-Clover/t/../cover_db_test/multi_file/cover_db')
failed: 512
----------8<----------8<----------8<----------8<----------8<----------
Show quoted text> The problems on the sandboxed testing systems arise in two situations
>
> 1) Devel::Cover is installed both in a system path AND in a .cpanplus
> folder in the sandbox
I would not call a module in the ".cpanplus" folder to be "installed".
Show quoted text> In this case, the wrong 'cover' command can be found based on a
> disconnect between the order
> of precedence in the PATH vs the order of precedence in the PERL5LIB
> env.
Trying to reliably call a script from a Perl distribution is impossible
if you can not trust the environment. If the 'cover' script found
$ENV{PATH} does not match the Devel::Cover in @INC, that is a problem
either with the original user environment or a bug in the CPAN client
that does not modifies PATH to match what it does with PERL5LIB.
The only right workaround would be to avoid using the 'cover' script at
all. But I understand that replicating its functionality is a tough job.
Maybe the solution would be to ask the Devel::Cover maintainer to
provide the functionality you need as a module instead of relying on the
script.
Show quoted text> 2) Devel::Cover is installed ONLY in the ~/.cpanplus folder
> (somewhere) and the PATH does not
> include a path which would let the OS find the 'cover' command
>
>
> Here is an example abbreviated environment line which caused problems.
> Note that
> Devel::Cover was installed in the .cpanplus folder in this case and it
> was not installed system
> wide. The 'cover' command did not exist anywhere in the EVN{PATH}...
> rather it was basically in
> $some_build_folder/cover (which is why $Devel::Cover::Inc::Base/cover
> is also checked).
Your assumption is that the module is installed. But that is not the
case. This is only smoke testing and only PERL5LIB is modified in that
environment to add the temporary Devel-Cover/lib. Personally, I think
that is a bug in the smoke tool and that PATH should also be modified by
the smoke tool.
Trying to find the cover script in that broken environment can not be
done reliably, unless with the $Devel::Cover::Inc::Base. But in that
case, it would be better to try to use it before trying $PATH.
Please, use my patch to fix the case of real non-broken environments.
I can also improve it to implement my suggestion above (using
$Devel::Cover::Inc::Base before $ENV{PATH}). Tell me.
--
Olivier Mengué -
http://perlresume.org/DOLMEN