Nicholas Clark wrote on 2009-08-28:
> 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...]
>
[...]
> 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?
Yes, File::Spec::Win32::rel2abs() does dynamic loading of Cwd when
called with no $base:
if ( !defined( $base ) || $base eq '' ) {
require Cwd ;
$base = Cwd::getdcwd( ($self->splitpath( $path ))[0] ) if defined
&Cwd::getdcwd ;
$base = $self->_cwd() unless defined $base ;
}
elsif ( ! $self->file_name_is_absolute( $base ) ) {
$base = $self->rel2abs( $base ) ;
}
else {
$base = $self->canonpath( $base ) ;
}
Hacking TestInit to do:
@new_inc = map { $_ = File::Spec::Functions::rel2abs($_,
'C:/gitclients/perl/ext/DynaLoader'); /(.*)/; $1 }
it now runs okay with the 'A' flag.
Thread Previous
|
Thread Next