develooper Front page | perl.perl5.porters | Postings from October 2010

Re: [perl #3719] perl_eval_{sv,pv} does not trap syntax errors

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
October 3, 2010 12:58
Subject:
Re: [perl #3719] perl_eval_{sv,pv} does not trap syntax errors
Message ID:
20101003195802.GE2653@iabyn.com
On Mon, Sep 27, 2010 at 12:44:16AM +0200, Leon Timmermans wrote:
> On Mon, Jul 26, 2010 at 3:18 AM, George Greer via RT
> <perlbug-followup@perl.org> wrote:
> > My embed-fu is weak, but it appears to be a simple fix.
> >
> > http://m-l.org/~perl/misc/0001-Fix-for-perl-3719-Preserve-for-perl_eval_pv-while-em.patch
> >
> > http://github.com/greerga/perl/commit/8ba06c38ccf1582a01143760851f9396c16b78f5
> >
> > or attached.
> 
> Disclaimer: I have embed-fu, but not so much internals-fu.
> 
> The G_KEEPERR flag seems to affect eval in at least 3 places
> 1) in doeval, right before compilation is tried.
> 2) in pp_leave, as the very last thing is does. I think this is only run on
> 3) in eval_sv, right after a successful eval.
> 
> I suspect this patch has a wider impact than intended. I don't really
> know if that's really a problem though.

The patch is wrong, unfortunately. It only "works" in some circumstances
because it exploits another bug whereby G_KEEPERR still sets $@ sometimes,

In particular: under the original fix, if $@ wasn't null when calling
eval_pv(pv,TRUE), it would croak, even if pv compiled and ran okay.

I've fixed the original bug with commit

    4aca2f62efca883199d7975f34b7fb876c280366

and fixed the G_KEEPERR issue with

    6b2fb389897a68db92c38c22f79403607f0da303

> Also, the fact that this G_KEEPERR behavior of eval_sv is not
> documented bothers me.

I've fixed that with

    be064c4a1f59651142e99788731ae1d164c19537

-- 
Thank God I'm an atheist.....

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About