Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exec and system call FETCH magic twice under -T #11759

Open
p5pRT opened this issue Nov 20, 2011 · 5 comments
Open

exec and system call FETCH magic twice under -T #11759

p5pRT opened this issue Nov 20, 2011 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented Nov 20, 2011

Migrated from rt.perl.org#104084 (status was 'open')

Searchable as RT104084$

@p5pRT
Copy link
Author

p5pRT commented Nov 20, 2011

From @Hugmeir

perl -T -E 'delete $ENV{PATH}; package D { sub TIESCALAR { return bless {},
shift } sub FETCH { say ++$y; } } tie $x, "D"; system $x; say ""; exec $x'

Which calls FETCH 4 times, not 2. Also, I might be missing something/being
particularly thick today, but the output doesn't make sense to me​:
1
2

2
3

Shouldn't that be 1, 2, 3, 4, not 1, 2, 2, 3?

@p5pRT
Copy link
Author

p5pRT commented Nov 20, 2011

From @cpansprout

On Sat Nov 19 16​:47​:51 2011, Hugmeir wrote​:

perl -T -E 'delete $ENV{PATH}; package D { sub TIESCALAR { return
bless {},
shift } sub FETCH { say ++$y; } } tie $x, "D"; system $x; say ""; exec $x'

Which calls FETCH 4 times, not 2. Also, I might be missing something/being
particularly thick today, but the output doesn't make sense to me​:
1
2

2
3

Shouldn't that be 1, 2, 3, 4, not 1, 2, 2, 3?

That second part reminds me of #96332, but I don’t think it’s related.
system() seems to be clearing $y somehow, even without threads.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Nov 20, 2011

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Nov 20, 2011

From @cpansprout

On Sat Nov 19 22​:18​:02 2011, sprout wrote​:

On Sat Nov 19 16​:47​:51 2011, Hugmeir wrote​:

perl -T -E 'delete $ENV{PATH}; package D { sub TIESCALAR { return
bless {},
shift } sub FETCH { say ++$y; } } tie $x, "D"; system $x; say "";
exec $x'

Which calls FETCH 4 times, not 2. Also, I might be missing
something/being
particularly thick today, but the output doesn't make sense to me​:
1
2

2
3

Shouldn't that be 1, 2, 3, 4, not 1, 2, 2, 3?

That second part reminds me of #96332, but I don’t think it’s related.
system() seems to be clearing $y somehow, even without threads.

Er, I meant even without taint.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Nov 21, 2011

From @tonycoz

On Sat, Nov 19, 2011 at 04​:47​:52PM -0800, Brian Fraser wrote​:

perl -T -E 'delete $ENV{PATH}; package D { sub TIESCALAR { return bless {},
shift } sub FETCH { say ++$y; } } tie $x, "D"; system $x; say ""; exec $x'

Which calls FETCH 4 times, not 2. Also, I might be missing something/being
particularly thick today, but the output doesn't make sense to me​:
1
2

2
3

Shouldn't that be 1, 2, 3, 4, not 1, 2, 2, 3?

The first "2" is inside a forked child, so the change isn't visible in
the parent.

Tony

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants