Skip Menu |

This queue is for tickets about the XSConfig CPAN distribution.

Report information
The Basics
Id: 125756
Status: resolved
Priority: 0/
Queue: XSConfig

People
Owner: Nobody in particular
Requestors: haarg [...] haarg.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Breaks DynaLoader on perl 5.8
This module breaks loading DynaLoader on perl 5.8. If DynaLoader is loaded before XSLoader, it will fail. DynaLoader creates a $VERSION variable but doesn't assign to it until after loading Config. Config (XSConfig) then loads XSLoader, which bootstraps DynaLoader. That bootstrapping fails because $VERSION doesn't match the object version. If XSLoader is loaded first, it bootstraps DynaLoader itself without loading DynaLoader.pm or creating the $DynaLoader::VERSION variable. When the variable doesn't exist, the bootstrapping doesn't do any version checks.
Subject: Re: [rt.cpan.org #125756] Breaks DynaLoader on perl 5.8
Date: Wed, 4 Jul 2018 14:58:48 +0200
To: bug-XSConfig [...] rt.cpan.org
From: Reini Urban <reini.urban [...] gmail.com>
If there's no easier fix (by version checking) I suggest to skip it for <= 5.8 then. Graham Knop via RT <bug-XSConfig@rt.cpan.org> schrieb am Mi., 4. Juli 2018, 13:41: Show quoted text
> Wed Jul 04 07:41:13 2018: Request 125756 was acted upon. > Transaction: Ticket created by haarg > Queue: XSConfig > Subject: Breaks DynaLoader on perl 5.8 > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: haarg@haarg.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=125756 > > > > This module breaks loading DynaLoader on perl 5.8. If DynaLoader is > loaded before XSLoader, it will fail. > > DynaLoader creates a $VERSION variable but doesn't assign to it until > after loading Config. Config (XSConfig) then loads XSLoader, which > bootstraps DynaLoader. That bootstrapping fails because $VERSION doesn't > match the object version. > > If XSLoader is loaded first, it bootstraps DynaLoader itself without > loading DynaLoader.pm or creating the $DynaLoader::VERSION variable. When > the variable doesn't exist, the bootstrapping doesn't do any version checks. >
On Wed Jul 04 08:59:22 2018, reini.urban@gmail.com wrote: Show quoted text
> If there's no easier fix (by version checking) I suggest to skip it > for <= > 5.8 then.
It may be possible to detect this situation and temporarily delete $DynaLoader::{VERSION}. I can't immediately think of another solution. For reference, here is a cpantesters failure report caused by this issue: http://www.cpantesters.org/cpan/report/58275cd4-7e2d-11e8-a442-11e896936435 Show quoted text
> > Graham Knop via RT <bug-XSConfig@rt.cpan.org> schrieb am Mi., 4. Juli > 2018, > 13:41: >
> > Wed Jul 04 07:41:13 2018: Request 125756 was acted upon. > > Transaction: Ticket created by haarg > > Queue: XSConfig > > Subject: Breaks DynaLoader on perl 5.8 > > Broken in: (no value) > > Severity: (no value) > > Owner: Nobody > > Requestors: haarg@haarg.org > > Status: new > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=125756 > > > > > > > This module breaks loading DynaLoader on perl 5.8. If DynaLoader is > > loaded before XSLoader, it will fail. > > > > DynaLoader creates a $VERSION variable but doesn't assign to it until > > after loading Config. Config (XSConfig) then loads XSLoader, which > > bootstraps DynaLoader. That bootstrapping fails because $VERSION > > doesn't > > match the object version. > > > > If XSLoader is loaded first, it bootstraps DynaLoader itself without > > loading DynaLoader.pm or creating the $DynaLoader::VERSION variable. > > When > > the variable doesn't exist, the bootstrapping doesn't do any version > > checks. > >
On Wed Jul 04 07:41:13 2018, haarg wrote: Show quoted text
> This module breaks loading DynaLoader on perl 5.8. If DynaLoader is > loaded before XSLoader, it will fail. > > DynaLoader creates a $VERSION variable but doesn't assign to it until > after loading Config. Config (XSConfig) then loads XSLoader, which > bootstraps DynaLoader. That bootstrapping fails because $VERSION > doesn't match the object version.
DynaLoader's from 5.8.7 bootstrap doesn't check version. I need a 1 liner showing the bug. --------------------------------- void __cdecl boot_DynaLoader(interpreter *my_perl, cv *cv) { interpreter *v2; // edi@1 int *v3; // ecx@1 int v4; // eax@1 int v5; // ebp@1 sv *v6; // eax@1 sv *v7; // eax@1 sv *v8; // eax@1 sv *v9; // eax@1 sv *v10; // eax@1 v2 = my_perl; v3 = my_perl->Tmarkstack_ptr; v4 = (4 * *v3 >> 2) + 1; my_perl->Tmarkstack_ptr = v3 - 1; v5 = v4; v6 = (sv *)Perl_newXS(my_perl, "DynaLoader::dl_load_file", XS_DynaLoader_dl_load_file, "dl_win32.c"); Perl_sv_setpv(my_perl, v6, "$;$"); v7 = (sv *)Perl_newXS(my_perl, "DynaLoader::dl_find_symbol", XS_DynaLoader_dl_find_symbol, "dl_win32.c"); Perl_sv_setpv(my_perl, v7, "$$"); v8 = (sv *)Perl_newXS(my_perl, "DynaLoader::dl_undef_symbols", XS_DynaLoader_dl_undef_symbols, "dl_win32.c"); Perl_sv_setpv(my_perl, v8, pv); v9 = (sv *)Perl_newXS(my_perl, "DynaLoader::dl_install_xsub", XS_DynaLoader_dl_install_xsub, "dl_win32.c"); Perl_sv_setpv(my_perl, v9, "$$;$"); v10 = (sv *)Perl_newXS(my_perl, "DynaLoader::dl_error", XS_DynaLoader_dl_error, "dl_win32.c"); Perl_sv_setpv(my_perl, v10, pv); dl_generic_private_init(my_perl); v2->Tstack_base[v5] = &v2->Isv_yes; v2->Tstack_sp = &v2->Tstack_base[v5]; } --------------------------------- Show quoted text
> > If XSLoader is loaded first, it bootstraps DynaLoader itself without > loading DynaLoader.pm or creating the $DynaLoader::VERSION variable. > When the variable doesn't exist, the bootstrapping doesn't do any > version checks.
On Fri Jul 06 11:47:20 2018, BULKDD wrote: Show quoted text
> On Wed Jul 04 07:41:13 2018, haarg wrote:
> > This module breaks loading DynaLoader on perl 5.8. If DynaLoader is > > loaded before XSLoader, it will fail. > > > > DynaLoader creates a $VERSION variable but doesn't assign to it until > > after loading Config. Config (XSConfig) then loads XSLoader, which > > bootstraps DynaLoader. That bootstrapping fails because $VERSION > > doesn't match the object version.
> > DynaLoader's from 5.8.7 bootstrap doesn't check version. I need a 1 > liner showing the bug.
I cant reproduce it. ---------------------------------- C:\perl528\srcnew>perl -v This is perl, v5.8.7 built for MSWin32-x86-multi-thread Copyright 1987-2005, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. C:\perl528\srcnew>perl -w -MDynaLoader -MXSLoader -e"print 0" 0 C:\perl528\srcnew> ----------------------------------
On Fri Jul 06 11:47:20 2018, BULKDD wrote: Show quoted text
> On Wed Jul 04 07:41:13 2018, haarg wrote:
> > This module breaks loading DynaLoader on perl 5.8. If DynaLoader is > > loaded before XSLoader, it will fail. > > > > DynaLoader creates a $VERSION variable but doesn't assign to it until > > after loading Config. Config (XSConfig) then loads XSLoader, which > > bootstraps DynaLoader. That bootstrapping fails because $VERSION > > doesn't match the object version.
> > DynaLoader's from 5.8.7 bootstrap doesn't check version. I need a 1 > liner showing the bug. > --------------------------------- > void __cdecl boot_DynaLoader(interpreter *my_perl, cv *cv) > { > interpreter *v2; // edi@1 > int *v3; // ecx@1 > int v4; // eax@1 > int v5; // ebp@1 > sv *v6; // eax@1 > sv *v7; // eax@1 > sv *v8; // eax@1 > sv *v9; // eax@1 > sv *v10; // eax@1 > > v2 = my_perl; > v3 = my_perl->Tmarkstack_ptr; > v4 = (4 * *v3 >> 2) + 1; > my_perl->Tmarkstack_ptr = v3 - 1; > v5 = v4; > v6 = (sv *)Perl_newXS(my_perl, "DynaLoader::dl_load_file", > XS_DynaLoader_dl_load_file, "dl_win32.c"); > Perl_sv_setpv(my_perl, v6, "$;$"); > v7 = (sv *)Perl_newXS(my_perl, "DynaLoader::dl_find_symbol", > XS_DynaLoader_dl_find_symbol, "dl_win32.c"); > Perl_sv_setpv(my_perl, v7, "$$"); > v8 = (sv *)Perl_newXS(my_perl, "DynaLoader::dl_undef_symbols", > XS_DynaLoader_dl_undef_symbols, "dl_win32.c"); > Perl_sv_setpv(my_perl, v8, pv); > v9 = (sv *)Perl_newXS(my_perl, "DynaLoader::dl_install_xsub", > XS_DynaLoader_dl_install_xsub, "dl_win32.c"); > Perl_sv_setpv(my_perl, v9, "$$;$"); > v10 = (sv *)Perl_newXS(my_perl, "DynaLoader::dl_error", > XS_DynaLoader_dl_error, "dl_win32.c"); > Perl_sv_setpv(my_perl, v10, pv); > dl_generic_private_init(my_perl); > v2->Tstack_base[v5] = &v2->Isv_yes; > v2->Tstack_sp = &v2->Tstack_base[v5]; > } > ---------------------------------
$ perl -MDynaLoader -e1 DynaLoader object version 1.05 does not match $DynaLoader::VERSION at /Users/gknop/perl5/perls/v5.8.7/lib/5.8.7/darwin-2level/XSLoader.pm line 16. Compilation failed in require at /Users/gknop/local-libs/587-xsconfig/lib/perl5/darwin-2level/Config.pm line 62. Compilation failed in require at /Users/gknop/perl5/perls/v5.8.7/lib/5.8.7/darwin-2level/DynaLoader.pm line 25. BEGIN failed--compilation aborted at /Users/gknop/perl5/perls/v5.8.7/lib/5.8.7/darwin-2level/DynaLoader.pm line 25. Compilation failed in require. BEGIN failed--compilation aborted. This is on darwin, but the report I linked shows that it happens on linux as well. Possibly the version check behavior is different on win32. Show quoted text
>
> > > > If XSLoader is loaded first, it bootstraps DynaLoader itself without > > loading DynaLoader.pm or creating the $DynaLoader::VERSION variable. > > When the variable doesn't exist, the bootstrapping doesn't do any > > version checks.
Fixed in 6.27, old 5.8.* perls on win32 didnt check $VERSION or $XS_VERSION because of a C bug that the ver chk code was compiled away by the CC but only on Win32 perl. That made my debugging much harder till I figured that out.