Fixing p5p's SIG{__WARN__} vs PL_warnhook for Coro

Marc Lehmann schmorp at schmorp.de
Fri May 6 22:30:47 CEST 2016


Hi!

Sorry, I am a bit slow these days, still catching up after some illness.

On Wed, May 04, 2016 at 10:38:15PM +1200, Kent Fredric <kentfredric at gmail.com> wrote:
> A few people are trying to fix the PL_warnhook vs $SIG{__WARN__} issue
> which Coro hit,

I am not quite sure such an issue exists, actually. The issue is that
perl needlessly changes its API in every release, breaking modules all
the time. The "this time" issue with Coro is yet another time using a
bullshit rationale to break a formerly public API, namedly making perl's
vtbls readonly, and the fix, has been identified already:

--- i/perl.h
+++ w/perl.h
@@ -5586 +5586 @@
-#define EXT_MGVTBL EXTCONST MGVTBL
+#define EXT_MGVTBL EXT MGVTBL

With this patch, Coro seems to work (if one gets perl to compile, which
also gets harder over releases due to needless breakage).

> but we're unable to find a reliable test for Coro which will let us know
> when we've actually fixed it to Coro's satisfaction.
> 
> Is there any light you can shed on this issue?

I think I can, although it won't be very satisfactory, I guess.

First, I assume you mean that something in how perl treats %SIG needs
fixing - that might be, but I haven't looked into this issue enough to
decide whether this is actually a bug in perl, so unless something else
has issues with perl's %SIG behaviour, I am not of the opinion that
something is necessarily wrong with perl (at least older ones that had
proper maintainers).

I think the warn/diehook behaviour is weird and practically asking for
trouble, but I have not found a way to trick perl into actually having
a bug, so I assume the behaviour works for perl (otherwise I'd have it
reported as a bug, or at least called it a bug in Changes etc.).

As for testcases, that's actually quite difficult. Coro itself has some
limited tests in t/13_diewarn.t (as you probably are aware already), but
if I remember correctly, these pass with recent perls, while real-world
programs relying on Coro's %SIG behaviour do fail. The test only ctaches
obvious bugs, and something more subtle is going on.

I have never had reason to investigate these issues in depth, as the
workaround that Coro implements never seemed to cause any issues, and Coro
has been extremely stable for quite many years now.

Another thing: the last time I seriously debugged these issues was
probably around 5.12 or so, and since it is a fixed problem, my desire for
completely understanding the subtle interactions wasn't so high. And of
course, I was forced to spend a lot of the available time working around
breakage and bugs introduced by the new regime of perl maintainers.

Or in other words, I don't know of a testcase that really nails the
missing case, but I know that things don't work (at least, with older
perls), even with the testcase passing.

And neither don't I see the reason why one would be needed - Coro works if
the real bug (API breakage) is fixed in perl, as witnessed by stableperl,
where Coro seems to work as well as it normally does.

So, fix identified, and working. I suspect the real issue is the
sutbbornness of the people who don't care about keeping perl a viable and
stable target for extensions, and are too stubborn to do a good job.

Greetings,

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the perl mailing list