First steps to resolving RT #120618, better fix for RT #120600
authorYves Orton <demerphq@gmail.com>
Sun, 24 Nov 2013 12:07:20 +0000 (13:07 +0100)
committerYves Orton <demerphq@gmail.com>
Sun, 24 Nov 2013 12:08:53 +0000 (13:08 +0100)
commit0ac75573be35d04f7799c8b980c842497e4cbd07
tree9bc12a1cfa27bde03d596e2e5b23f6d901c5c7e9
parent673d92672305ecff194d9f5f014741146a16e0c4
First steps to resolving RT #120618, better fix for RT #120600

Commit 099ec7dcf9e085a650e6d9010c12ad9649209bf4 tried to fix RT #120618,
however it resulted in RT #120600:

    [perl #120618] Bleadperl v5.19.6-15-g099ec7d breaks ABIGAIL/Regexp-Common-2013031301.tar.gz

Which includes breakage to:

    MAUKE/Function-Parameters-1.0401.tar.gz
    ABIGAIL/Regexp-Common-2013031301.tar.gz
    DCONWAY/Regexp-Grammars-1.033.tar.gz
    AMBS/Text/Text-RewriteRules-0.25.tar.gz

To put it bluntly I didn't like the fix in 099ec7dcf9 in and it doesn't
entirely surprise me that it broke extreme modules like these.

This is a much better fix, and includes better debug output for frames
and recursion.

Both of the old strategies were flawed. The new strategy is much more
sound. Every time we recurse we create a new recursed bitmap, if
necessary copying the existing bitmap (thus treated a NULL "recursed"
pointer as an all zero bitmap). Instead of turning off the flag when
we exit, we simply "throw away" that bitmap, restoring the state of
the parent. Thus what occured in a child does not contaminate the
parent.

All of this is a bit confusing as there are two levels of recursion
at work here. First there is recursion, and pseudo-recursion in
study_chunk(), which is distinct from recursive patterns, even tho
the implementation of recursive patterns uses pseudo-recursion in
study-chunk.  Anyway, to make the new bitmap pattern work I had to
extend the frame mechanism, and add diagnostics to it, which are
visible via -Mre=Debug,ALL.

I haven't tested that this fixes the modules, I just know that it
is conceptually a much better and cleaner fix.
regcomp.c