Dual-Life/Devel-PPPort

caller_cx() problem with recent versions of Devel::PPPort on Perl 5.10

iynehz opened this issue · 4 comments

If you look at the CPANTS reports of Devel::Callsite on Perl 5.20 http://matrix.cpantesters.org/?dist=Devel-Callsite%200.08;perl=5.10.1;reports=1 , you see that it's good with some older versions of Devel::PPPort, like 3.19 or 3.23. But with recent versions of Devel::PPPort like 3.35 it fails like http://www.cpantesters.org/cpan/report/0ee94684-632e-11e6-96a0-c17658b9f28c

In my own environment I was using Devel::PPPort 3.30 and it failed. It becomes good after I switched to a Devel::PPPort 3.20.

The problem partially lies in Devel::Callsite.

It's doing two things wrong:

  • It's generating a ppport.h on the fly from whatever is installed on the system

Modules that wish to use Devel::PPPort should generate a version of ppport.h from Devel::PPPort and ship that with their modules, to prevent breakages just like this.

Second, if you run ppport.h against Callsite.xs, it says this:

$ perl5.10.1 ppport.h Callsite.xs
[...]
*** WARNING: Uses caller_cx, which may not be portable below perl 5.6.0, even with 'ppport.h'
File needs caller_cx, adding static request
Analysis completed (1 warning)
Suggested changes:
--- Callsite.xs	2014-03-10 04:46:16.000000000 -0400
+++ Callsite.xs.patched	2017-03-16 10:37:10.630632661 -0400
@@ -1,6 +1,7 @@
 #include <EXTERN.h>
 #include <perl.h>
 #include <XSUB.h>
+#define NEED_caller_cx
 #include "ppport.h"
 
 #ifndef caller_cx

If you add in that define and compile, Devel::Callsite is happy!

I've done this and made a pull request to Devel::Callsite here: rocky/Perl-Devel-Callsite#4

Thanks for the report!

@mhx , I think we can avoid issues like these by not defining things in ppport.h if we aren't providing them. This seems strange:

#ifndef eval_pv
[...]
#ifdef eval_pv
#  undef eval_pv
#endif
#define eval_pv(a,b) DPPP_(my_eval_pv)(aTHX_ a,b)
#define Perl_eval_pv DPPP_(my_eval_pv)
#endif 

So... if eval_pv is not defined, but the module using ppport.h hasn't said #NEED_eval_pv.. we still define the symbol to point to a Devel::PPPort symbol that doesn't exist!

I just looked at the current code, and couldn't find anything like this construct.

I'm wondering if this has been fixed already.

No response from anyone in 7 months, so I'm closing