develooper Front page | perl.perl5.porters | Postings from August 2009

[PATCH] perl -e 'readdir($x = ".")' test

Thread Next
From:
Shlomi Fish
Date:
August 13, 2009 21:37
Subject:
[PATCH] perl -e 'readdir($x = ".")' test
Message ID:
200908140737.12188.shlomif@iglu.org.il
Hi!

Resending because the patch was not applied yet (or alternatively I wasn't 
informed that it was applied.

I was disappointed that this bug:

* http://rt.perl.org/rt3/Public/Bug/Display.html?id=68182

* http://community.livejournal.com/shlomif_tech/30579.html

was patched without a regression test, so the 
attached patch adds one. Please apply it. You can also "git pull" it from:

http://github.com/shlomif/perl/tree/blead

Regards,

	Shlomi Fish

On Friday 07 August 2009 17:01:21 Rafael Garcia-Suarez wrote:
> 2009/8/7 Nicholas Clark <nick@ccl4.org>:
> > Given that the bug was introduced here:
> >
> > http://perl5.git.perl.org/perl.git/commit/53c1dcc098c6cc47963786f1928061d
> >90b5d
> >
> > and "not NULL" attributions were similarly added to gv_AVadd() and
> > gv_HVadd(), which both start:
> >
> > GV *
> > Perl_gv_AVadd(pTHX_ register GV *gv)
> > {
> >    PERL_ARGS_ASSERT_GV_AVADD;
> >
> >    if (!gv || SvTYPE((const SV *)gv) != SVt_PVGV)
> >        Perl_croak(aTHX_ "Bad symbol for array");
> >    if (!GvAV(gv))
> >        GvAV(gv) = newAV();
> >    return gv;
> > }
> >
> > GV *
> > Perl_gv_HVadd(pTHX_ register GV *gv)
> > {
> >    PERL_ARGS_ASSERT_GV_HVADD;
> >
> >    if (!gv || SvTYPE((const SV *)gv) != SVt_PVGV)
> >        Perl_croak(aTHX_ "Bad symbol for hash");
> >    if (!GvHV(gv))
> >        GvHV(gv) = newHV();
> >    return gv;
> > }
> >
> >
> > a: is it possible to find ways to make these assert()/SEGV from Perl
> > space?
>
> I don't think so.
>
> > b: should we remove the "NN" annotation for them, or "fix" the C code?
> >
> > Question "a" is interesting, in that the crash for GVs happens because
> > there is a NULL pushed onto the stack somewhere, popped here in
> > pp_readdir:
> >
> >    GV * const gv = MUTABLE_GV(POPs);
> >
> > I didn't think that NULLs were legal on Perl's stack.
>
> What happens for globs is that the compiler will convert a bareword
> into a glob name. That doesn't happen with sigillified variable
> identifiers.

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/

God gave us two eyes and ten fingers so we will type five times as much as we
read.

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