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

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

Thread Previous | Thread Next
From:
Leon Timmermans
Date:
February 17, 2015 16:28
Subject:
Re: [perl #123775] Args to 'system' not evaluated before forking,making $$ wrong
Message ID:
CAHhgV8jRXrgX4jU-nb+g3MnZQ=SQP1nXagy-OWUchHj7B=exsw@mail.gmail.com
On Mon, Feb 16, 2015 at 6:23 PM, Chris Wagner via RT <
perlbug-followup@perl.org> wrote:

> On Sat Feb 14 17:10:11 2015, LeonT wrote:
> > I would still expect that to run into pseudothreads on Windows, but I
> > haven't tested either version on Windows yet.
> >
> > Leon
>
> The problem on Windows is likely masked by the pseudo-fork.  It prints the
> "right pid".  I verified that two Perl processes get made with the right
> pids in TaskInfo.
>
> C:\>perl -le "print qq/$^V\nparent pid $$/; system qw/perl -le/, q/print
> qq{passed pid $ARGV[0]\nchild pid $$}/, $$;"
> v5.20.0
> parent pid 12060
> passed pid 12060
> child pid 13764
>
> This can be elucidated with the following fork example.
> C:\>perl -le "print qq/start pid $$/; if ($p=fork) { print qq/parent p
> `$p` pid $$/; sleep 10; } else { print qq/child p `$p` pid $$/; sleep 10; }
> "
> start pid 6928
> parent p `-9540` pid 6928
> child p `0` pid -9540
>
> This pid is negative and there is only ever one Perl process in TaskInfo.
> So I would say that any improper symbol evaluation is taking place in the
> 2nd thread.  This could still be a problem depending on what is behind a
> tie()'d variable.
>

That is exactly what I'd expect.

>
> I've come up with this command line that could serve as a universal test
> case for system() atleast.  Change the quotation marks for Unix of course.
> perl -le "print qq/$^V\nparent pid $$/; system qw/perl -le/, q/print
> qq{passed pid $ARGV[0]\nchild pid $$}/, $$;"
>

I'm not completely sure I understand. Are you saying my second patch isn't
working on Windows?


> Does GETMAGIC cause FETCH to be executed on tie()'d variables?
>

Yes.

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