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

*ISA glob assignment may break inheritance cache #14411

Open
p5pRT opened this issue Jan 11, 2015 · 3 comments
Open

*ISA glob assignment may break inheritance cache #14411

p5pRT opened this issue Jan 11, 2015 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented Jan 11, 2015

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

Searchable as RT123585$

@p5pRT
Copy link
Author

p5pRT commented Jan 11, 2015

From @dur-randir

The following two snippets result in 'Can't locate object method "foo" via package "G"' error, though they must succeed instead​:

*F​::foo = sub {};
*G​::ISA = ['H'];
$G​::ISA[0] = 'F';
G->foo;

===========

*F​::foo = sub {};
*G​::ISA = ['H'];
*G​::foo = ['H'];
*G​::ISA = *G​::foo;
$G​::ISA[0] = 'F';
G->foo;

The reason for this is that in glob_assign_glob and gv_setref only PERL_MAGIC_isa magic is assigned to the AV slot, but nothing to it's content. And PERL_MAGIC_isa -> PERL_MAGIC_isaelem propagation occurs only upon array write access, and not for individual elements' r/w access.

@p5pRT
Copy link
Author

p5pRT commented Mar 25, 2016

From @iabyn

On Sun, Jan 11, 2015 at 08​:19​:33AM -0800, Sergey Aleynikov wrote​:

# New Ticket Created by Sergey Aleynikov
# Please include the string​: [perl #123585]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=123585 >

The following two snippets result in 'Can't locate object method "foo" via package "G"' error, though they must succeed instead​:

*F​::foo = sub {};
*G​::ISA = ['H'];
$G​::ISA[0] = 'F';
G->foo;

===========

*F​::foo = sub {};
*G​::ISA = ['H'];
*G​::foo = ['H'];
*G​::ISA = *G​::foo;
$G​::ISA[0] = 'F';
G->foo;

The reason for this is that in glob_assign_glob and gv_setref only
PERL_MAGIC_isa magic is assigned to the AV slot, but nothing to it's
content. And PERL_MAGIC_isa -> PERL_MAGIC_isaelem propagation occurs
only upon array write access, and not for individual elements' r/w
access.

The first one was fixed by this​:

  commit 8452c1a
  Author​: Tony Cook <tony@​develop-help.com>
  Date​: Tue Jan 26 15​:53​:34 2016 +1100

  [perl #127351] add isaelem magic on *Foo​::ISA = arrayref

The second one still fails in blead.

--
The Enterprise is captured by a vastly superior alien intelligence which
does not put them on trial.
  -- Things That Never Happen in "Star Trek" #10

@p5pRT
Copy link
Author

p5pRT commented Mar 25, 2016

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

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

No branches or pull requests

2 participants