In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/1e8125c621275d18c74bc8dae3bfc3c03929fe1e?hp=33bb4a44218ade1a7fe78a286569fafa4ab02b7d>
- Log ----------------------------------------------------------------- commit 1e8125c621275d18c74bc8dae3bfc3c03929fe1e Author: Florian Ragwitz <[email protected]> Date: Tue Jul 20 22:58:24 2010 +0200 Check API compatibility when loading xs modules This adds PL_apiversion, allowing the API version of a running interpreter to be introspected. It is used in the new XS_APIVERSION_BOOTCHECK macro, which is added to the _boot function of every XS module, to compare it against the API version the module has been compiled against. If the versions do not match, an exception is thrown. This doesn't fully prevent binary incompatible extensions to be loaded. It merely compares PERL_API_* between compile- and runtime, and does not attempt to solve the problem of identifying binary incompatible perls with the same API version (i.e. the same perl version configured with and without DEBUGGING). M XSUB.h M cpan/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm M embedvar.h M intrpvar.h M perl.c M perl.h M perlapi.h M sv.c commit 3b462feda21356499e651643c80692cc1c5e6787 Author: Florian Ragwitz <[email protected]> Date: Mon Jul 26 15:47:43 2010 +0200 Update AUTHORS M AUTHORS commit 5aa7664711e0d046dbe8136094f7ef73ae4e9659 Author: Florian Ragwitz <[email protected]> Date: Mon Jul 26 15:02:03 2010 +0200 More perldelta M pod/perl5134delta.pod ----------------------------------------------------------------------- Summary of changes: AUTHORS | 3 +- XSUB.h | 30 ++++++++++++++++++++++-- cpan/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm | 5 +++- embedvar.h | 2 + intrpvar.h | 1 + perl.c | 2 + perl.h | 4 +++ perlapi.h | 2 + pod/perl5134delta.pod | 19 +++++++++++++++- sv.c | 1 + 10 files changed, 63 insertions(+), 6 deletions(-) diff --git a/AUTHORS b/AUTHORS index d73e46f..1321b97 100644 --- a/AUTHORS +++ b/AUTHORS @@ -609,6 +609,7 @@ Larry Shatzer <[email protected]> Larry W. Virden <[email protected]> Larry Wall <[email protected]> Lars Hecking <[email protected]> +Lars D¿¿¿¿¿¿ ¿¿¿ <[email protected]> Laszlo Molnar <[email protected]> Leif Huhn <[email protected]> Len Johnson <[email protected]> @@ -625,7 +626,7 @@ Luke Ross <[email protected]> Lubomir Rintel <[email protected]> Lupe Christoph <[email protected]> Luther Huffman <[email protected]> -Maik Hentsche <[email protected]> +Maik Hentsche <[email protected]> Major Sébastien <[email protected]> Makoto MATSUSHITA <[email protected]> Malcolm Beattie <[email protected]> diff --git a/XSUB.h b/XSUB.h index f3ba802..939a7a6 100644 --- a/XSUB.h +++ b/XSUB.h @@ -243,6 +243,10 @@ Macro to verify that a PM module's $VERSION variable matches the XS module's C<XS_VERSION> variable. This is usually handled automatically by C<xsubpp>. See L<perlxs/"The VERSIONCHECK: Keyword">. +=for apidoc Ams||XS_APIVERSION_BOOTCHECK +Macro to verify that the perl api version an XS module has been compiled against +matches the api version of the perl interpreter it's being loaded into. + =head1 Simple Exception Handling Macros =for apidoc Ams||dXCPT @@ -335,6 +339,26 @@ Rethrows a previously caught exception. See L<perlguts/"Exception Handling">. # define XS_VERSION_BOOTCHECK #endif +#define XS_APIVERSION_BOOTCHECK \ + STMT_START { \ + SV *_xpt = NULL; \ + SV *_compver = Perl_newSVpv(aTHX_ "v" PERL_API_VERSION_STRING, 0); \ + SV *_runver = new_version(PL_apiversion); \ + _compver = upg_version(_compver, 0); \ + if (vcmp(_compver, _runver)) { \ + _xpt = Perl_newSVpvf(aTHX_ "Perl API version %"SVf \ + " of %s does not match %"SVf, \ + SVfARG(Perl_sv_2mortal(aTHX_ vstringify(_compver))), \ + SvPV_nolen_const(ST(0)), \ + SVfARG(Perl_sv_2mortal(aTHX_ vstringify(_runver)))); \ + Perl_sv_2mortal(aTHX_ _xpt); \ + } \ + SvREFCNT_dec(_compver); \ + SvREFCNT_dec(_runver); \ + if (_xpt) \ + Perl_croak_sv(aTHX_ _xpt); \ + } STMT_END + #ifdef NO_XSLOCKS # define dXCPT dJMPENV; int rEtV = 0 # define XCPT_TRY_START JMPENV_PUSH(rEtV); if (rEtV == 0) @@ -343,9 +367,9 @@ Rethrows a previously caught exception. See L<perlguts/"Exception Handling">. # define XCPT_RETHROW JMPENV_JUMP(rEtV) #endif -/* - The DBM_setFilter & DBM_ckFilter macros are only used by - the *DB*_File modules +/* + The DBM_setFilter & DBM_ckFilter macros are only used by + the *DB*_File modules */ #define DBM_setFilter(db_type,code) \ diff --git a/cpan/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm b/cpan/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm index 385e2fb..cde1a40 100644 --- a/cpan/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm +++ b/cpan/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm @@ -1004,8 +1004,11 @@ EOF print Q(<<"EOF"); # PERL_UNUSED_VAR(cv); /* -W */ # PERL_UNUSED_VAR(items); /* -W */ +##ifdef XS_APIVERSION_BOOTCHECK +# XS_APIVERSION_BOOTCHECK; +##endif EOF - + print Q(<<"EOF") if $WantVersionChk ; # XS_VERSION_BOOTCHECK ; # diff --git a/embedvar.h b/embedvar.h index 25c033c..587bc94 100644 --- a/embedvar.h +++ b/embedvar.h @@ -65,6 +65,7 @@ #define PL_Xpv (vTHX->IXpv) #define PL_amagic_generation (vTHX->Iamagic_generation) #define PL_an (vTHX->Ian) +#define PL_apiversion (vTHX->Iapiversion) #define PL_argvgv (vTHX->Iargvgv) #define PL_argvout_stack (vTHX->Iargvout_stack) #define PL_argvoutgv (vTHX->Iargvoutgv) @@ -395,6 +396,7 @@ #define PL_IXpv PL_Xpv #define PL_Iamagic_generation PL_amagic_generation #define PL_Ian PL_an +#define PL_Iapiversion PL_apiversion #define PL_Iargvgv PL_argvgv #define PL_Iargvout_stack PL_argvout_stack #define PL_Iargvoutgv PL_argvoutgv diff --git a/intrpvar.h b/intrpvar.h index 1e01e43..21fb933 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -228,6 +228,7 @@ PERLVAR(Iwarnhook, SV *) /* switches */ PERLVAR(Ipatchlevel, SV *) +PERLVAR(Iapiversion, SV *) PERLVAR(Ilocalpatches, const char * const *) PERLVARI(Isplitstr, const char *, " ") diff --git a/perl.c b/perl.c index d52d79f..404372c 100644 --- a/perl.c +++ b/perl.c @@ -348,6 +348,7 @@ perl_construct(pTHXx) PL_stashcache = newHV(); PL_patchlevel = newSVpvs("v" PERL_VERSION_STRING); + PL_apiversion = newSVpvs("v" PERL_API_VERSION_STRING); #ifdef HAS_MMAP if (!PL_mmap_page_size) { @@ -877,6 +878,7 @@ perl_destruct(pTHXx) Safefree(PL_inplace); PL_inplace = NULL; SvREFCNT_dec(PL_patchlevel); + SvREFCNT_dec(PL_apiversion); if (PL_e_script) { SvREFCNT_dec(PL_e_script); diff --git a/perl.h b/perl.h index 32cf787..59df0aa 100644 --- a/perl.h +++ b/perl.h @@ -4900,6 +4900,10 @@ typedef struct exitlistentry { STRINGIFY(PERL_VERSION) "." \ STRINGIFY(PERL_SUBVERSION) +#define PERL_API_VERSION_STRING STRINGIFY(PERL_API_REVISION) "." \ + STRINGIFY(PERL_API_VERSION) "." \ + STRINGIFY(PERL_API_SUBVERSION) + #ifdef PERL_GLOBAL_STRUCT struct perl_vars { # include "perlvars.h" diff --git a/perlapi.h b/perlapi.h index 742bb3a..869d512 100644 --- a/perlapi.h +++ b/perlapi.h @@ -166,6 +166,8 @@ END_EXTERN_C #define PL_amagic_generation (*Perl_Iamagic_generation_ptr(aTHX)) #undef PL_an #define PL_an (*Perl_Ian_ptr(aTHX)) +#undef PL_apiversion +#define PL_apiversion (*Perl_Iapiversion_ptr(aTHX)) #undef PL_argvgv #define PL_argvgv (*Perl_Iargvgv_ptr(aTHX)) #undef PL_argvout_stack diff --git a/pod/perl5134delta.pod b/pod/perl5134delta.pod index a5baed6..3cb696b 100644 --- a/pod/perl5134delta.pod +++ b/pod/perl5134delta.pod @@ -98,6 +98,14 @@ XXX =over 4 +=item C<Archive::Tar> + +Upgraded from version 1.64 to 1.66. + +Among other things, the new version adds a new option to C<ptar> to allow safe +creation of tarballs without world-writable files on Windows, allowing those +archives to be uploaded to CPAN. + =item C<B::Lint> Upgraded from version 1.11 to 1.12. @@ -255,7 +263,7 @@ that they represent may be covered elsewhere. =item * -XXX +F<t/op/print.t> has been added to test implicit printing of C<$_>. =back @@ -381,6 +389,15 @@ C<@DB::args>. Several memory leaks when loading XS modules were fixed. +=item * + +A panic in the regular expression optimizer has been fixed (RT#75762). + +=item * + +Assignments to lvalue subroutines now honor copy-on-write behavior again, which +has been broken since version 5.10.0 (RT#75656). + =back =head1 Known Problems diff --git a/sv.c b/sv.c index 10e41a9..b2383fd 100644 --- a/sv.c +++ b/sv.c @@ -12283,6 +12283,7 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags, /* switches */ PL_minus_c = proto_perl->Iminus_c; PL_patchlevel = sv_dup_inc(proto_perl->Ipatchlevel, param); + PL_apiversion = sv_dup_inc(proto_perl->Iapiversion, param); PL_localpatches = proto_perl->Ilocalpatches; PL_splitstr = proto_perl->Isplitstr; PL_minus_n = proto_perl->Iminus_n; -- Perl5 Master Repository
