develooper Front page | perl.perl5.porters | Postings from June 2019

[perl #134177] Argument croak_on_error for eval_pv() is broken

Thread Previous
From:
Tony Cook via RT
Date:
June 24, 2019 01:42
Subject:
[perl #134177] Argument croak_on_error for eval_pv() is broken
Message ID:
rt-4.0.24-21775-1561340554-344.134177-15-0@perl.org
On Thu, 20 Jun 2019 02:51:32 -0700, pali@cpan.org wrote:
> On Thursday 20 June 2019 02:49:00 Tony Cook via RT wrote:
> > On Thu, Jun 20, 2019 at 10:18:40AM +0200, pali@cpan.org wrote:
> > > > > > doesn't solve this?
> > > > >
> > > > > So is clobbering of $@ in eval_sv() possible or not?
> > > >
> > > > Evals called within whatever code eval_sv() calls can still
> > > > clobber $@.
> > >
> > > I tried to play with it, but I was not able to write any code which
> > > would clobber $@. And provide incorrect result with SvROK + SvTRUE
> > > checks. So it is really possible?
> >
> > It has no effect on that, I meant that:
> >
> > ./perl -Ilib -MXS::APItest -le '$@ = "foo"; eval_sv("eval q/1/",
> > G_KEEPERR); print $@'
> >
> > $@ isn't preserved.
> 
> I mean $@ clobbering in eval_pv(). E.g. when eval_pv() is called with
> croak_on_error=1.

eval_pv() never uses (and never will for compatibility) the G_KEEPERR flag when calling eval_sv(), so it will always clobber $@.

Tony

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=134177

Thread Previous


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