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
panic: top_env when localizing a lexical variable in qr{(?{...})} #1327
Comments
From gnat@prometheus.frii.comCreated by gnat@frii.comThis program: #!/opt/perl/5.6.0-RC1/bin/perl -w gives: panic: top_env Localizing a lexical in the main body of the programs throws an Perl Info
|
From @Abigail $ perl -e '/(?{"})/' This happens with 5.7.2 too. This is the smallest program that gives Abigail Perl Info
|
From @jhiI think we may need to revisit our "test random garbage", now only
|
From @vanstynAs I understand it, this occurs because when compiling an re_eval, Roughly, we need to claim to be in an eval for runtime compiling to Before any of that will be of use, however, we need to determine what At the moment you will find that wrapping an eval around these regexps Hugo |
From @mjdominus my $d; plover% perl /tmp/c2.pl Perl Info
|
From @rgarciaHappens also with the much simpler case |
From jfriedl@yahoo.comIt seems that the regex % ./perl -Ilib -Dr -e 'm/(?{ (?!) })/' Jeffrey Perl Info
|
From [Unknown Contact. See original ticket]Jeffrey Friedl <jfriedl@yahoo.com> wrote:
More concisely, the following panics : |
From [Unknown Contact. See original ticket]On tisdag, april 9, 2002, at 11:04 , rgarciasuarez@free.fr wrote:
I I tried fixing this roughly a year ago but got lost. You get a stack Arthur |
From jfriedl@yahoo.comUsing 'local' on a 'my' variable within (?{...}) causes a panic: % perl -e 'my $x; m/(?{ local $x})/' I don't know if this is related to [ID 20020409.001] http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2002-04/msg00730.html or not, but this seems much more serious. Jeffrey Perl Info
|
From [Unknown Contact. See original ticket]En réponse à Jeffrey Friedl <jfriedl@yahoo.com>:
IIRC, this bug is known, I even tried to correct it some
I don't think it's related : 20020409.001 is a parsing bug : |
From @TuxOn Wed 10 Apr 2002 09:15, Jeffrey Friedl <jfriedl@yahoo.com> wrote:
Might even go back much further: [ID 20001005.002] Lexical variables in regex code blocks not propagated Though that one does not panic. It's on Hugo's TODO list, but not with high
-- |
From [Unknown Contact. See original ticket]H Merijn Brand <h.m.brand@hccnet.nl> wrote: This close to RC1, it's probably ``don't look, don't tell'' :-) |
From @mjdominusI reported this back in November: Subject: [ID 20011107.089] panic in top_env when localizing a lexical variable inside of qr{(?{...})} |
From @floatingatoll[gnat@prometheus.frii.com - Sun Mar 12 12:19:00 2000]:
The panic still happens, as of @17821. |
From perl-5.8.0@ton.iguana.beCreated by perl-5.8.0@ton.iguana.beperl -we '/(?{"})/' Perl Info
|
From @hvds"perl-5.8.0@ton.iguana.be (via RT)" <perlbug-followup@perl.org> wrote: This is a known problem. It may be fixable (along with several other Hugo |
From @floatingatoll[RT_System - Tue Apr 9 17:37:22 2002]:
It continues to panic, as of @18374. |
From @floatingatollFound two more duplicate tickets on this problem, there may be more. Linked. |
From @smpetersThis problem still exists as of Perl 5.8.5. |
From painquin@gmail.com$ perl This is perl, v5.8.7 built for x86_64-linux I think I can safely say the cause of the problem is the unterminated string This was found thanks to a piece of code that loads pairs of regexps and - andy |
From @rgarciaOn 2/10/06, via RT andy hohorst <perlbug-followup@perl.org> wrote:
A variant :
That's precisely because the compilation fails that we get this error. $ perl -Mre=eval -e 'qr/(?{1+})/' |
The RT System itself - Status changed from 'new' to 'open' |
p5p@spam.wizbit.be - Status changed from 'open' to 'stalled' |
From zefram@fysh.orgCreated by zefram@fysh.org$ perl -lwe '"abc" =~ m{(?{ BEGIN{foo()} })}' Looks like a fault with exception handling. sv_compile_2op() does set Perl Info
|
From @iabynI've added this to the "(?.{...}) is brain-damaged" metaticket, 34161 |
The RT System itself - Status changed from 'new' to 'open' |
From @gannett-ggreerA better description for this bug would be "(?{...}) does not catch Changes:#!/opt/perl/5.6.0-RC1/bin/perl -w used to give: panic: top_env now gives: Can't localize lexical variable $foo at (re_eval 1) line 2. =================================== was: panic: top_env now: Can't find string terminator '"' anywhere before EOF at (re_eval 1) line 1. =================================== was: panic: top_env now: Can't localize lexical variable $d at (re_eval 1) line 1. =================================== was: (blank; already worked in blead) now: (same) =================================== was: panic: top_env now: Search pattern not terminated or ternary operator parsed as search (I accidentally did: perl -e '(?{ (?!) })' at first and interestingly it made it a regex anyway. This is unchanged =================================== was: panic: top_env now: Search pattern not terminated at (re_eval 1) line 1. =================================== was: panic: top_env now: Can't localize lexical variable $x at (re_eval 1) line 2. =================================== Tests pass (except am unrelated random Benchmark.t failure). Attached to http://m-l.org/~perl/misc/0001-Fix-for-RT-2353-catch-yyparse-exceptions-in.patch http://github.com/greerga/perl/commit/20701986306ff8ab4eb6dfe63a0079e0268a932d |
From @gannett-ggreer0001-Fix-for-RT-2353-catch-yyparse-exceptions-in.patchFrom 20701986306ff8ab4eb6dfe63a0079e0268a932d Mon Sep 17 00:00:00 2001
From: George Greer <perl@greerga.m-l.org>
Date: Sat, 10 Jul 2010 19:18:12 -0400
Subject: [PATCH] Fix for RT#2353: catch yyparse() exceptions in (?{...})
Ticket is entitled:
"panic: top_env when localizing a lexical variable in qr{(?{...})}"
but a better description would be:
"(?{...}) does not catch yyparse() exceptions in regex compilation"
Changes Perl_sv_compile_2op() to tell doeval() that it must use
S_try_yyparse() to catch any exception that yyparse() may throw.
---
pp_ctl.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/pp_ctl.c b/pp_ctl.c
index 912e934..e5addde 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2914,6 +2914,7 @@ Perl_sv_compile_2op(pTHX_ SV *sv, OP** startop, const char *code, PAD** padp)
int runtime;
CV* runcv = NULL; /* initialise to avoid compiler warnings */
STRLEN len;
+ bool need_catch;
PERL_ARGS_ASSERT_SV_COMPILE_2OP;
@@ -2965,11 +2966,14 @@ Perl_sv_compile_2op(pTHX_ SV *sv, OP** startop, const char *code, PAD** padp)
PL_op->op_flags = 0; /* Avoid uninit warning. */
PUSHBLOCK(cx, CXt_EVAL|(IN_PERL_COMPILETIME ? 0 : CXp_REAL), SP);
PUSHEVAL(cx, 0);
+ need_catch = CATCH_GET;
+ CATCH_SET(TRUE);
if (runtime)
(void) doeval(G_SCALAR, startop, runcv, PL_curcop->cop_seq);
else
(void) doeval(G_SCALAR, startop, PL_compcv, PL_cop_seqmax);
+ CATCH_SET(need_catch);
POPBLOCK(cx,PL_curpm);
POPEVAL(cx);
--
1.7.0.4
|
From @rgarciaOn 11 July 2010 01:24, George Greer via RT <perlbug-followup@perl.org> wrote:
Thanks, applied as 634d691 |
@rgs - Status changed from 'open' to 'resolved' |
From @cpansproutThis is a duplicate of 2353, fixed by |
@cpansprout - Status changed from 'open' to 'resolved' |
From @cpansprout |
@cpansprout - Status changed from 'stalled' to 'resolved' |
Migrated from rt.perl.org#2353 (status was 'resolved')
Searchable as RT2353$
The text was updated successfully, but these errors were encountered: