summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2020-03-12 14:14:24 +0000
committerDavid Mitchell <davem@iabyn.com>2020-03-18 15:23:37 +0000
commitad89278aa25475fb03971aec66692e18e35d9c07 (patch)
tree372b56d33bbb6f03b330f5e7f0be3a1a85a92dd9 /op.c
parent2f07b2fb1d76d4d4f344f296ee3432f3f3ce4580 (diff)
downloadperl-ad89278aa25475fb03971aec66692e18e35d9c07.tar.gz
fixup to "avoid identical stack traces" - try 2
GH #15109, #17567 [ this commit was originally applied as v5.31.9-121-gfb8188b84d, but was quickly reverted by v5.31.9-124-g6311900a66. I'm now -re-applying it, but with a 'SAVEFREEOP(PL_curcop)' added, which was missing from the original commit. ] My original fix for this issue, v5.31.6-141-gf2f32cd638 made a shallow copy of &PL_compiling. However, for non-default warning bits, this made two COPs share the malloced() cop_warnings, and bad things ensured. In particular this was flagged up in: GH #17567: "BBC: AYOUNG/OpenVZ-0.01.tar.gz" The fix in this commit is to do a deep copy of the COP using newSTATEOP().
Diffstat (limited to 'op.c')
-rw-r--r--op.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/op.c b/op.c
index 954bb32f57..0b8e961803 100644
--- a/op.c
+++ b/op.c
@@ -11712,10 +11712,9 @@ S_process_special_blocks(pTHX_ I32 floor, const char *const fullname,
* to PL_compiling, IN_PERL_COMPILETIME/IN_PERL_RUNTIME
* will give the wrong answer.
*/
- Newx(PL_curcop, 1, COP);
- StructCopy(&PL_compiling, PL_curcop, COP);
- PL_curcop->op_slabbed = 0;
- SAVEFREEPV(PL_curcop);
+ PL_curcop = (COP*)newSTATEOP(PL_compiling.op_flags, NULL, NULL);
+ CopLINE_set(PL_curcop, CopLINE(&PL_compiling));
+ SAVEFREEOP(PL_curcop);
}
PUSHSTACKi(PERLSI_REQUIRE);