summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2012-09-16 14:25:02 +0200
committerDavid Mitchell <davem@iabyn.com>2013-07-28 10:33:36 +0100
commit8fe3c67a9d33417c317107b8f5a56ca88d4153a9 (patch)
treef432ce58c55cf7407fe5ec65f82d0421f609bfa7 /pp_ctl.c
parent63b37c5b629988880eac5bf297d5319cbc572436 (diff)
downloadperl-8fe3c67a9d33417c317107b8f5a56ca88d4153a9.tar.gz
fix 114884 positive GPOS lookbehind regex substitution failure
This also corrects a test added in 2c2969659ae1c534e7f3fac9e7a7d186defd9943 which was arguably wrong. The details of \G are a bit fuzzy, and IMO its a little hard to say exactly what is right, although it generally is clear what is wrong.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 17121be104..5c6999b1c3 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -226,12 +226,13 @@ PP(pp_substcont)
if (SvTAINTED(TOPs))
cx->sb_rxtainted |= SUBST_TAINT_REPL;
sv_catsv_nomg(dstr, POPs);
- /* XXX: adjust for positive offsets of \G for instance s/(.)\G//g with positive pos() */
- s -= RX_GOFS(rx);
-
+ /* XXX: the RX_GOFS stuff is to adjust for positive offsets of
+ * \G for instance s/(.)\G//g with positive pos(). See #69056 and #114884
+ * This whole \G thing makes a *lot* of things more difficult than they
+ * should be. - Yves */
/* Are we done */
if (CxONCE(cx) || s < orig ||
- !CALLREGEXEC(rx, s, cx->sb_strend, orig,
+ !CALLREGEXEC(rx, s - RX_GOFS(rx), cx->sb_strend, orig,
(s == m) + RX_GOFS(rx), cx->sb_targ, NULL,
(REXEC_IGNOREPOS|REXEC_NOT_FIRST)))
{