On Fri, Aug 28, 2009 at 03:08:26PM +0100, Steve Hay wrote:
> Nicholas Clark wrote on 2009-08-28:

> > The logic is here
> > http://perl5.git.perl.org/perl.git/blob/HEAD:/t/TEST#l26 and here
> > http://perl5.git.perl.org/perl.git/blob/HEAD:/t/TEST#l202
> > 
> > I wonder if that's it
> 
> Ah, so *that*'s where the test actually gets run!
> 
> I stuck in a print statement to see what the $run command-line actually
> is. In the relative path case it is:
> 
> ../../perl -I../../t -MTestInit=U2T,A,NC "-T" t/DynaLoader.t |
> 
> whereas in the absolute path case it is:
> 
> ./perl -I. -MTestInit "-T"
> C:/gitclients/perl/ext/DynaLoader/t/DynaLoader.t |
> 
> so it looks like the (broken) relative path case has done a cd into
> ext/DynaLoader, and the (working) absolute path case has not. Is that
> expected?
> 
> Running the first of those command-lines from the ext/DynaLoader, it
> seems that it is actually the "A" flag that causes the breakage, not the
> "NC" flag:
> 
> C:\gitclients\perl\ext\DynaLoader>..\..\perl -I../../t
> -MTestInit=U2T,A,NC "-T" t/DynaLoader.t
> Not enough arguments for DynaLoader::dl_load_file at t/DynaLoader.t line
> 90, near "() "
> BEGIN not safe after errors--compilation aborted at t/DynaLoader.t line
> 94.
> 
> C:\gitclients\perl\ext\DynaLoader>..\..\perl -I../../t -MTestInit=U2T,NC
> "-T" t/DynaLoader.t
> 1..40
> ok 1 - use DynaLoader;
> ok 2 - DynaLoader->can('bootstrap')
> [...all tests pass ok...]

That's bonkers. Given that the import routine is

sub import {
    my $self = shift;
    my $abs;
    foreach (@_) {
        if ($_ eq 'U2T') {
            @new_inc = ('../../lib', '../../t');
        } elsif ($_ eq 'NC') {
            delete $ENV{PERL_CORE}
        } elsif ($_ eq 'A') {
            $abs = 1;
        } else {
            die "Unknown option '$_'";
        }
    }

    if ($abs) {
        if(!...@new_inc) {
            @new_inc = '../lib';
        }
        @INC = @new_inc;
        require File::Spec::Functions;
        # Forcibly untaint this.
        @new_inc = map { $_ = File::Spec::Functions::rel2abs($_); /(.*)/; $1 }
            @new_inc;
        $^X = File::Spec::Functions::rel2abs($^X);
    }

    if (@new_inc) {
        new_inc(@new_inc);
        set_opt(@new_inc);
    }
}


it's going to process things in this order:

            @new_inc = ('../../lib', '../../t');
            $abs = 1;
            delete $ENV{PERL_CORE}

        @INC = @new_inc;
        require File::Spec::Functions;
        # Forcibly untaint this.
        @new_inc = map { $_ = File::Spec::Functions::rel2abs($_); /(.*)/; $1 }
            @new_inc;
        $^X = File::Spec::Functions::rel2abs($^X);


So, somehow, require File::Spec::Functions; or running
File::Spec::Functions::rel2abs() is triggering this. So do they do
dynamic loading somewhere? And why is doing it with a relative path and
then the same relative path made absolute going to upset it?

(we don't need to run the DynaLoader test with absolute paths. Currently only
Devel-PPPort and Cwd really needed it. But it would be nice to work out *why*
this is failing)

Nicholas Clark

Reply via email to