You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Nikolay Ananiev <an...@thegdb.com> on 2006/10/05 12:10:43 UTC

Fix buggy boot_ statements in modperl_xsinit.c

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


Re: Fix buggy boot_ statements in modperl_xsinit.c

Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
On 5-Oct-06, at 5:10 AM, Nikolay Ananiev wrote:

> 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);

Thanks, checked in as revision 463493