-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BBC: Blead (cdbed2a) Breaks RDF::Trine (and others) #22914
Comments
RDF-Trine has so many prereqs that bisecting is taking a long time. Based on the failure reports and examination of https://metacpan.org/release/GWILLIAMS/RDF-Trine-1.019/source/lib/RDF/Trine/Parser/RDFPatch.pm#L194, I'm going to guess that the breaking commit is cdbed2a.
@richardleach, can you examine further and perhaps discuss with upstream author? Thanks. |
Shorter reproducer:
It's trying to modify |
Confirmed. Bisecting that also points to commit cdbed2a. |
Also likely affected: IO-Async Spreadsheet-WriteExcel JSON-Validator Template-Simple |
I have a patch that seems to fix this issue: diff --git peep.c peep.c
index e9de45eb0a..797c13113f 100644
--- peep.c
+++ peep.c
@@ -3869,7 +3869,7 @@ Perl_rpeep(pTHX_ OP *o)
break;
case OP_SUBSTR: {
- OP *expr, *offs, *len;
+ OP *expr, *offs, *len, *repl = NULL;
/* Specialize substr($x, 0, $y) and substr($x,0,$y,"") */
/* Does this substr have 3-4 args and amiable flags? */
if (
@@ -3897,7 +3897,7 @@ Perl_rpeep(pTHX_ OP *o)
if (cMAXARG3x(o) == 4) {/* replacement */
/* Is the replacement string CONST ""? */
- OP *repl = OpSIBLING(len);
+ repl = OpSIBLING(len);
if (repl->op_type != OP_CONST)
break;
SV *repl_sv = cSVOPx_sv(repl);
@@ -3912,8 +3912,15 @@ Perl_rpeep(pTHX_ OP *o)
/* (The finalizer does not seem to change op_next here) */
expr->op_next = offs->op_next;
o->op_private = cMAXARG3x(o);
- if (cMAXARG3x(o) == 4)
+ if (repl) {
+ while (
+ len->op_type == OP_NULL
+ && (len->op_flags & OPf_KIDS)
+ )
+ len = cUNOPx(len)->op_first;
+ assert(len->op_next == repl);
len->op_next = o;
+ }
/* We have a problem if padrange pushes the expr OP for us,
* then jumps straight to the offs CONST OP. For example: But I wrote it by trying to fix the symptoms of the issue, so I don't know how complete (or correct) it really is. |
Scratch that attempt; |
Revised patch based on that idea: diff --git peep.c peep.c
index e9de45eb0a..d311d2bdf4 100644
--- peep.c
+++ peep.c
@@ -3869,7 +3869,7 @@ Perl_rpeep(pTHX_ OP *o)
break;
case OP_SUBSTR: {
- OP *expr, *offs, *len;
+ OP *expr, *offs, *len, *repl = NULL;
/* Specialize substr($x, 0, $y) and substr($x,0,$y,"") */
/* Does this substr have 3-4 args and amiable flags? */
if (
@@ -3897,7 +3897,7 @@ Perl_rpeep(pTHX_ OP *o)
if (cMAXARG3x(o) == 4) {/* replacement */
/* Is the replacement string CONST ""? */
- OP *repl = OpSIBLING(len);
+ repl = OpSIBLING(len);
if (repl->op_type != OP_CONST)
break;
SV *repl_sv = cSVOPx_sv(repl);
@@ -3912,8 +3912,6 @@ Perl_rpeep(pTHX_ OP *o)
/* (The finalizer does not seem to change op_next here) */
expr->op_next = offs->op_next;
o->op_private = cMAXARG3x(o);
- if (cMAXARG3x(o) == 4)
- len->op_next = o;
/* We have a problem if padrange pushes the expr OP for us,
* then jumps straight to the offs CONST OP. For example:
@@ -3924,7 +3922,13 @@ Perl_rpeep(pTHX_ OP *o)
* B::Deparse. :/ */
op_null(offs);
- /* repl status unchanged because it makes Deparsing easier. */
+ /* There can be multiple pointers to repl, too:
+ * substr $x, 0, $y ? 2 : 3, "";
+ * So instead of rewriting all of len, null out repl.
+ */
+ if (repl) {
+ op_null(repl);
+ }
/* Upgrade the SUBSTR to a SUBSTR_LEFT */
OpTYPE_set(o, OP_SUBSTR_LEFT); |
@mauke many thanks for doing the legwork before I could look at it. 🎆 🏆 |
No, what I've posted here is pretty much all I have (and |
Local testing suggests this should (unsurprisingly) be fixed by b1397c4 |
This is a bug report for perl from "Carlos Guevara" [email protected],
generated with the help of perlbug 1.43 running under perl 5.41.8.
BBC: Blead Breaks RDF::Trine
Please see http://fast-matrix.cpantesters.org/?dist=RDF::Trine
Flags
Perl configuration
The text was updated successfully, but these errors were encountered: