On Sun, 2 Mar 2003 at 14:32 +0100, Andreas J. Koenig <[EMAIL PROTECTED]:
> >>>>> On Sun, 2 Mar 2003 00:22:30 -0800 (PST), David Dyck <[EMAIL PROTECTED]> said:
>
> > Here's a smaller script that assume that Inline::C has
> > been installed and passes its test with perl 5.8.0, but
> > fails with todays 5.8.1.
>
> The infinite loop with your example program started with patch 18533
> on the trunk.
If I apply patch 18533 in reverse to regexec.c, then the infinite loop
goes away. Of course, that breaks the test case that was added
to t/op/subst.t! (I've only included the regexec.c portion
of patch 18533)
Change 18533 by [EMAIL PROTECTED] on 2003/01/21 02:15:29
Subject: Re: [perl #17757] s///g fails when using English & study in 5.8.0
From: [EMAIL PROTECTED]
Date: Thu, 02 Jan 2003 14:33:49 +0000
Message-Id: <[EMAIL PROTECTED]>
Affected files ...
... //depot/perl/regexec.c#297 edit
Differences ...
==== //depot/perl/regexec.c#297 (text) ====
Index: perl/regexec.c
--- perl/regexec.c#296~18529~ Mon Jan 20 16:44:20 2003
+++ perl/regexec.c Mon Jan 20 18:15:29 2003
@@ -541,6 +541,9 @@
start_shift + (s - strbeg), end_shift, pp, 0);
else
goto fail_finish;
+ /* we may be pointing at the wrong string */
+ if (s && RX_MATCH_COPIED(prog))
+ s = prog->subbeg + (s - SvPVX(sv));
if (data)
*data->scream_olds = s;
}
@@ -1858,6 +1861,9 @@
: (s = fbm_instr((unsigned char*)HOP3(s, back_min, strend),
(unsigned char*)strend, must,
PL_multiline ? FBMrf_MULTILINE : 0))) ) {
+ /* we may be pointing at the wrong string */
+ if ((flags & REXEC_SCREAM) && RX_MATCH_COPIED(prog))
+ s = prog->subbeg + (s - SvPVX(sv));
DEBUG_r( did_match = 1 );
if (HOPc(s, -back_max) > last1) {
last1 = HOPc(s, -back_min);
@@ -1944,6 +1950,9 @@
end_shift, &scream_pos, 1); /* last one */
if (!last)
last = scream_olds; /* Only one occurrence. */
+ /* we may be pointing at the wrong string */
+ else if (RX_MATCH_COPIED(prog))
+ s = prog->subbeg + (s - SvPVX(sv));
}
else {
STRLEN len;