perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nikolay Ananiev" <anan...@thegdb.com>
Subject Fix buggy boot_ statements in modperl_xsinit.c
Date Thu, 05 Oct 2006 10:10:43 GMT
I spotted this on cygwin and perl 5.8.7, but it might happen on other
platforms too.
The problem is that $Config{static_ext} contains  ' Win32CORE' (with a
leading space)
and when ExtUtils::Embed::static_ext() splits the value we get an array with
2
elements - the space and Win32CORE.
Then ExtUtils::Embed::xsinit doesn't check the array and directly generates
modperl_xsinit.c,
which contains the following buggy lines:

EXTERN_C void boot_ (pTHX_ CV* cv);

and

newXS("::bootstrap", boot_, file);


Generally speaking, this is a problem with ExtUtils::Embed and not with
mod_perl and I will send a
patch for the module to p5p, but fixing this stuff in modperl for the old
versions of ExtUtils::Embed won't cost
anything.


Index: Code.pm
===================================================================
--- Code.pm (revision 453125)
+++ Code.pm (working copy)
@@ -777,7 +777,14 @@

     my $xsinit = "$self->{path}/modperl_xsinit.c";
     debug "generating...$xsinit";
-
+
+    # There's a possibility that $Config{static_ext} may contain spaces and
+    # ExtUtils::Embed::xsinit won't handle the situation right. In this
case
+    # we'll get buggy "boot_" statements in modperl_xsinit.c. Fix this by
cleaning
+    # the @Extensions array.
+    ExtUtils::Embed::static_ext(); # Loads @Extensions if not loaded
+    @ExtUtils::Embed::Extensions = grep{$_} @ExtUtils::Embed::Extensions;
+
     #create bootstrap method for static xs modules
     my $static_xs = [keys %{ $build->{XS} }];
     ExtUtils::Embed::xsinit($xsinit, 1, $static_xs);







---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message