develooper Front page | perl.perl5.porters | Postings from March 2015

Re: [perl #123775] Args to 'system' not evaluated before forking,making $$ wrong

Thread Previous | Thread Next
From:
Leon Timmermans
Date:
March 4, 2015 23:43
Subject:
Re: [perl #123775] Args to 'system' not evaluated before forking,making $$ wrong
Message ID:
CAHhgV8ivQ7k1fsci9uVotjZxXGWhmRgtCAYdZfEFCy-AGJ2LsA@mail.gmail.com
On Wed, Feb 18, 2015 at 4:46 AM, Tony Cook via RT <perlbug-followup@perl.org
> wrote:

> On Fri Feb 13 16:46:53 2015, LeonT wrote:
> > On Sat, Feb 14, 2015 at 1:32 AM, Karl Williamson <
> public@khwilliamson.com>
> > wrote:
> >
> > > That is out-of-date.  All new code should use spaces exclusively.
> > >
> >
> > In that case, updated.
>
> diff --git a/doio.c b/doio.c
> index a63f2a2..dc4de86 100644
> --- a/doio.c
> +++ b/doio.c
> @@ -1544,7 +1544,7 @@ Perl_do_aexec5(pTHX_ SV *really, SV **mark, SV **sp,
> -               *a++ = SvPV_nolen_const(*mark);
> +        *a++ = SvPV_nomg_nolen(*mark);
> diff --git a/mathoms.c b/mathoms.c
> index 2a65fb4..6ad8eb3 100644
> --- a/mathoms.c
> +++ b/mathoms.c
> @@ -713,8 +713,12 @@ Perl_do_binmode(pTHX_ PerlIO *fp, int iotype, int
> mode)
>
> +    for (current = mark + 1; current <= SP; current++) {
> +        SvGETMAGIC(*current);
> +    }
> diff --git a/pp_sys.c b/pp_sys.c
> index e2f8edf..7e4ff61 100644
> --- a/pp_sys.c
> +++ b/pp_sys.c
> @@ -4259,6 +4259,12 @@ PP(pp_system)
> +    else {
> +        while (++MARK <= SP) {
> +            (void)SvGETMAGIC(*MARK);      /* For get magic */
> +        }
> +        MARK = ORIGMARK;
> +    }
>
> Do we care about overloading?  It isn't triggered by SvGETMAGIC()
> and will still be happening in the child.
>

Good point. I suspect the clean way out of this is to rethink do_aexec5 to
just take char** arguments.

Leon

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