develooper Front page | perl.perl5.porters | Postings from November 2014

Re: ExtUtils-MakeMaker and Win32 woes: call for assistance

Thread Previous
From:
bulk88
Date:
November 1, 2014 00:14
Subject:
Re: ExtUtils-MakeMaker and Win32 woes: call for assistance
Message ID:
BLU436-SMTP10FEE3C9251E0FFCE70E93DF9B0@phx.gbl
Father Chrysostomos wrote:
>> The branch http://perl5.git.perl.org/perl.git/shortlog/refs/heads/bingos/eumm-7.01_03 has ExtUtils-MakeMaker-7.01_04
>> integrated and it is failing the cpan/ExtUtils-MakeMaker/t/miniperl.t test
>> as follows:
> ...
>> Can't use an undefined value as a symbol reference at ../../lib/Cwd.pm line 618.
> 
> This code is wrong:
> 
>     if (*{$DynaLoader::{boot_DynaLoader}}{CODE}) {
> 
> If $DynaLoader::{boot_DynaLoader} is undef because MakeMaker::Test::NoXS
> deleted it, then it croaks.  It should be something like:
> 
>     if ($DynaLoader::{boot_DynaLoader} && *{$DynaLoader::{boot_DynaLoader}}{CODE}) {
> 
> I suspect Cwd is being loaded earlier than before.  There is another ref-
> erence to this typeglob earlier on in Cwd.pm that would vivify it when
> Cwd is loaded, causing that test not to fail.
> 
> I don't think this is a very robust approach at all.  We are switching
> to miniperl mode after loading several things.  And this also causes a
> run-time penalty for cwd on Windows.  miniperl.t ought to be deleting
> $DynaLoader::{boot_DynaLoader} at the very top in a BEGIN block.  Or this
> test should actually be run with miniperl.  (Though if it is not being
> run with miniperl, why can't it be run in the CPAN release?)
> 

-----------------------------------------------------------
sub _win32_cwd {
     # Need to avoid taking any sort of reference to the typeglob or the 
code in
     # the optree, so that this tests the runtime state of things, as the
     # ExtUtils::MakeMaker tests for "miniperl" need to be able to fake 
things at
     # runtime by deleting the subroutine. *foo{THING} syntax on a 
symbol table
     # lookup avoids needing a string eval, which has been reported to cause
     # problems (for reasons that we haven't been able to get to the 
bottom of -
     # rt.cpan.org #56225)
     if (*{$DynaLoader::{boot_DynaLoader}}{CODE}) {
	$ENV{'PWD'} = Win32::GetCwd();
     }
     else { # miniperl
	chomp($ENV{'PWD'} = `cd`);
     }
     $ENV{'PWD'} =~ s:\\:/:g ;
     return $ENV{'PWD'};
}
-----------------------------------------------------------

other receipies used in p5p repo (cpan grep is down ATM)

-----------------------------------------------------------
if (defined &DynaLoader::boot_DynaLoader) {
     require XSLoader;
     XSLoader::load();
}
# else we're miniperl
# We need to work for miniperl, because the XS toolchain uses 
Text::Wrap, which
# uses re 'taint'.
------------------------------------------------------------------
=head3 can_load_xs

     my $can_load_xs = $self->can_load_xs;

Returns true if we have the ability to load XS.

This is important because miniperl, used to build XS modules in the
core, can not load XS.

=cut

sub can_load_xs {
     return defined &DynaLoader::boot_DynaLoader ? 1 : 0;
}
------------------------------------------------------------------

Win32::GetCwd is XS in Win32.dll (an XS module). Win32::GetCwd glob is 
present in ALL full perl builds at all times due to Win32CORE 
static-only module. Win32 the CPAN XS module used to be universal.c 
style permanently available, probably even available in Win32 miniperl 
back in the day. Eventually it was decided that Win32::* functions need 
to be spun off into an independently maintained and upgradable CPAN 
module. For back compat reasons, the older Win32::* subs have to be 
always "available" without a "require Win32;" so Win32CORE was made as a 
lazy loader/tail caller.

I added a carp backtrace to cwd code.
-------------------------------------------------
C:\perl521\srcnew\t>perl -I../lib 
-IC:\perl521\srcnew\cpan\ExtUtils-MakeMaker\t\
lib ../cpan/ExtUtils-MakeMaker/t/miniperl.t
ok 1 - setup
ok 2 - chdir'd to Big-Dummy
ok 3 - run("C:\perl521\srcnew\t\perl.exe" Makefile.PL)
ok 4 - run("nmake")
ok 5
Can't use an undefined value as a symbol reference at ../lib/Cwd.pm line 
620.
  at ../lib/Cwd.pm line 627.
         Cwd::_win32_cwd() called at ../lib/File/Path.pm line 218
         File::Path::rmtree("Big-Dummy/Liar") called at 
C:\perl521\srcnew\cpan\Ex
tUtils-MakeMaker\t\lib/MakeMaker/Test/Setup/BFD.pm line 124
         MakeMaker::Test::Setup::BFD::teardown_recurs() called at 
../cpan/ExtUtil
s-MakeMaker/t/miniperl.t line 45
         main::END() called at ../cpan/ExtUtils-MakeMaker/t/miniperl.t 
line 0
         eval {...} called at ../cpan/ExtUtils-MakeMaker/t/miniperl.t line 0
END failed--call queue aborted.
1..5
# Looks like your test exited with 255 just after 5.

C:\perl521\srcnew\t>

-----------------------------------------------------
Dump of DynaLoader stash right before the     if 
(*{$DynaLoader::{boot_DynaLoader}}{CODE}) { in CWD with " 
Dump(\%{main::DynaLoader::});"
-----------------------------------------------------
SV = IV(0x1024648) at 0x102464c
   REFCNT = 1
   FLAGS = (TEMP,ROK)
   RV = 0x36969c
   SV = PVHV(0x36eb4c) at 0x36969c
     REFCNT = 2
     FLAGS = (OOK,SHAREKEYS,OVERLOAD)
     AUX_FLAGS = 0
     ARRAY = 0xe33ed4  (0:36, 1:23, 2:4, 3:1)
     hash quality = 107.4%
     KEYS = 34
     FILL = 28 (cached = 0)
     MAX = 63
     RITER = -1
     EITER = 0x0
     RAND = 0xa5a3860a
     NAME = "DynaLoader"
     ENAME = "DynaLoader"
     BACKREFS = 0x97ceec
     SV = PVAV(0x95f894) at 0x97ceec
       REFCNT = 2
       FLAGS = ()
       ARRAY = 0xe82bec
       FILL = 40
       MAX = 47
       ARYLEN = 0x0
       FLAGS = ()
       Elt No. 0
       SV = PVGV(0x8f31dc) at 0x3696ac
         REFCNT = 1
         FLAGS = (PADSTALE,RMG,MULTI)
         MAGIC = 0x8fa1dc
           MG_VIRTUAL = &PL_vtbl_backref
           MG_TYPE = PERL_MAGIC_backref(<)
           MG_OBJ = 0x3696bc
         NAME = "boot_DynaLoader"
         NAMELEN = 15
         GvSTASH = 0x36969c      "DynaLoader"
         FLAGS = 0x2
         GP = 0x8fa164
           SV = 0x0
           REFCNT = 1
           IO = 0x0
           FORM = 0x0
           AV = 0x0
           HV = 0x0
           CV = 0x3696bc
           CVGEN = 0x0
           GPFLAGS = 0x0 ()
           LINE = 0
           FILE = "../cpan/ExtUtils-MakeMaker/t/miniperl.t"
           EGV = 0x3696ac        "boot_DynaLoader"
       Elt No. 1
       SV = PVGV(0x951534) at 0x97cedc
         REFCNT = 1
         FLAGS = (PADSTALE,RMG,MULTI)
         MAGIC = 0x952fbc
           MG_VIRTUAL = &PL_vtbl_backref
           MG_TYPE = PERL_MAGIC_backref(<)
           MG_OBJ = 0x9880f4
         NAME = "dl_error"
         NAMELEN = 8
         GvSTASH = 0x36969c      "DynaLoader"
         FLAGS = 0x2
         GP = 0x986f9c
           SV = 0x0
           REFCNT = 1
           IO = 0x0
           FORM = 0x0
           AV = 0x0
           HV = 0x0
           CV = 0x9880f4
           CVGEN = 0x0
           GPFLAGS = 0x0 ()
           LINE = 14
           FILE = "../lib/XSLoader.pm"
           EGV = 0x97cedc        "dl_error"
       Elt No. 2
       SV = PVGV(0x951574) at 0x987754
         REFCNT = 1
         FLAGS = (PADSTALE,RMG,MULTI)
         MAGIC = 0x977654
           MG_VIRTUAL = &PL_vtbl_backref
           MG_TYPE = PERL_MAGIC_backref(<)
           MG_OBJ = 0x988074
         NAME = "dl_load_file"
         NAMELEN = 12
         GvSTASH = 0x36969c      "DynaLoader"
         FLAGS = 0x2
         GP = 0x9897b4
           SV = 0x0
           REFCNT = 1
           IO = 0x0
           FORM = 0x0
           AV = 0x0
           HV = 0x0
           CV = 0x988074
           CVGEN = 0x0
           GPFLAGS = 0x0 ()
           LINE = 33
           FILE = "../lib/XSLoader.pm"
           EGV = 0x987754        "dl_load_file"
       Elt No. 3
       SV = PVGV(0x951594) at 0x987ba4
         REFCNT = 1
         FLAGS = (PADSTALE,MULTI)
         NAME = "dl_require_symbols"
         NAMELEN = 18
         GvSTASH = 0x36969c      "DynaLoader"
         FLAGS = 0x2
         GP = 0x98b78c
           SV = 0x0
           REFCNT = 1
           IO = 0x0
           FORM = 0x0
           AV = 0x987bd4
           HV = 0x0
           CV = 0x0
           CVGEN = 0x0
           GPFLAGS = 0x0 ()
           LINE = 58
           FILE = "../lib/XSLoader.pm"
           EGV = 0x987ba4        "dl_require_symbols"
     MRO_WHICH = "dfs" (0x280cbd2c)
     CACHE_GEN = 0x1
     PKG_GEN = 0x14
     MRO_LINEAR_CURRENT = 0xe5d2c4
     SV = PVAV(0xe4b598) at 0xe5d2c4
       REFCNT = 1
       FLAGS = (READONLY,PROTECT)
       ARRAY = 0xe6190c
       FILL = 0
       MAX = 3
       ARYLEN = 0x0
       FLAGS = (REAL)
       Elt No. 0
       SV = PV(0xc7396c) at 0xe5d284
         REFCNT = 1
         FLAGS = (POK,IsCOW,pPOK)
         PV = 0x8fa100 "DynaLoader"
         CUR = 10
         LEN = 0
     ISA = 0xe5d1c4
     SV = PVHV(0xb13c74) at 0xe5d1c4
       REFCNT = 1
       FLAGS = (READONLY,PROTECT,SHAREKEYS)
       ARRAY = 0xe8f1ec  (0:6, 1:2)
       hash quality = 125.0%
       KEYS = 2
       FILL = 2
       MAX = 7
       Elt "UNIVERSAL" HASH = 0x9e2de144
       SV = NULL(0x0) at 0x366014
         REFCNT = 2147481942
         FLAGS = (READONLY,PROTECT)
       Elt "DynaLoader" HASH = 0x39a7b776
       SV = NULL(0x0) at 0x366014
         REFCNT = 2147481942
         FLAGS = (READONLY,PROTECT)
     Elt "dl_librefs" HASH = 0x27744cc0
     SV = PVGV(0x9515b4) at 0x987d24
       REFCNT = 2
       FLAGS = (PADSTALE,MULTI)
       NAME = "dl_librefs"
       NAMELEN = 10
       GvSTASH = 0x36969c        "DynaLoader"
       FLAGS = 0x2
       GP = 0x98d8ac
         SV = 0x0
         REFCNT = 1
         IO = 0x0
         FORM = 0x0
         AV = 0x987d34
         HV = 0x0
         CV = 0x0
         CVGEN = 0x0
         GPFLAGS = 0x0 ()
         LINE = 73
         FILE = "../lib/XSLoader.pm"
         EGV = 0x987d24  "dl_librefs"
     Elt "VERSION" HASH = 0x3e8d102
     SV = PVGV(0xe5e51c) at 0xe2ff64
       REFCNT = 1
       FLAGS = (PADSTALE,MULTI)
       NAME = "VERSION"
       NAMELEN = 7
       GvSTASH = 0x36969c        "DynaLoader"
       FLAGS = 0x2
       GP = 0xe7a884
         SV = 0xe2ffa4
         REFCNT = 1
         IO = 0x0
         FORM = 0x0
         AV = 0x0
         HV = 0x0
         CV = 0x0
         CVGEN = 0x0
         GPFLAGS = 0x0 ()
         LINE = 19
         FILE = "../lib/DynaLoader.pm"
         EGV = 0xe2ff64  "VERSION"
     Elt "dl_unload_file" HASH = 0x660fb282
     SV = PVGV(0x9516b4) at 0x9880a4
       REFCNT = 1
       FLAGS = (RMG,MULTI)
       MAGIC = 0x98efe4
         MG_VIRTUAL = &PL_vtbl_backref
         MG_TYPE = PERL_MAGIC_backref(<)
         MG_OBJ = 0x9880b4
       NAME = "dl_unload_file"
       NAMELEN = 14
       GvSTASH = 0x36969c        "DynaLoader"
       FLAGS = 0x2
       GP = 0x98efa4
         SV = 0x0
         REFCNT = 1
         IO = 0x0
         FORM = 0x0
         AV = 0x0
         HV = 0x0
         CV = 0x9880b4
         CVGEN = 0x0
         GPFLAGS = 0x0 ()
         LINE = 13
         FILE = "../lib/XSLoader.pm"
         EGV = 0x9880a4  "dl_unload_file"
----------------------------------------------------
2 other dumps, boot_Dynaloader is actually present and wasn't deleted, 
the "$DynaLoader" has something to do with it I think. My knowledge of 
globs  is too poor to comment further.
----------------------------------------------------
     Dump(*main::DynaLoader::boot_DynaLoader{CODE});
SV = IV(0xfee380) at 0xfee384
   REFCNT = 1
   FLAGS = (TEMP,ROK)
   RV = 0x3696bc
   SV = PVCV(0x8f6234) at 0x3696bc
     REFCNT = 2
     FLAGS = (ISXSUB)
     COMP_STASH = 0x0
     XSUB = 0x280c6da4
     XSUBANY = 0
     GVGV::GV = 0x3696ac "DynaLoader" :: "boot_DynaLoader"
     FILE = "perllib.c"
     DEPTH = 0
     FLAGS = 0x8
     OUTSIDE_SEQ = 0
     PADLIST = 0x0
     OUTSIDE = 0x0 (null)
     Dump($DynaLoader::{boot_DynaLoader});
SV = NULL(0x0) at 0x366014
   REFCNT = 2147481941
   FLAGS = (READONLY,PROTECT)
---------------------------------------------------

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About