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

setting mro 'c3' doesn't work for utf8 packages. #285

Closed
toddr opened this issue Oct 24, 2015 · 4 comments
Closed

setting mro 'c3' doesn't work for utf8 packages. #285

toddr opened this issue Oct 24, 2015 · 4 comments

Comments

@toddr
Copy link
Collaborator

toddr commented Oct 24, 2015

Program:

#!./perl

use utf8;
binmode STDOUT, ':utf8';

package Diᚪၚd_A;
sub hèllò { 'Diᚪၚd_A::hèllò' }

package Diᚪၚd_B;
use base 'Diᚪၚd_A';

package Diᚪၚd_C;
use base 'Diᚪၚd_A';     

sub hèllò { 'Diᚪၚd_C::hèllò' }

package Diᚪၚd_D;
use base ('Diᚪၚd_B', 'Diᚪၚd_C');
use mro 'c3';

package main;
my $got = mro::get_linear_isa('Diᚪၚd_D');
$got->[3] eq 'Diᚪၚd_A' and print "ok\n";
$got->[2] eq 'Diᚪၚd_C' and print "ok\n";

perlcc -r test.pl returns nothing.

@toddr
Copy link
Collaborator Author

toddr commented Oct 24, 2015

So I suspected the issue was related to this line of code found in 3 places:

$init->add_eval('mro::set_mro($package, "c3");');

My suspicion was that the eval wasn't working right for UTF8 strings in 5.22

So I patched B::C to use the MRO XS code instead. NOTE: this has to be done in init2 since mro has to bootstrap c3 in its XS init before you can set mro to c3.

I also determined that in the above code, the Diᚪၚd_D package stash was never getting saved I suspect this might be distracting you in #219 and can be resolved if you find a way to assure the package is marked used.

I noticed this code which seems to mark a package used but prevent it from saving its stash?

         unless ( $B::C::dumped_package{$package} ) {
            $B::C::dumped_package{$package} = 1;
             mark_package( $package, 1 );
      }

@toddr
Copy link
Collaborator Author

toddr commented Oct 24, 2015

Applying my patch gets these tests working:

mro/basic_01_c3_utf8.t TESTS some tests are now failing
mro/basic_02_c3_utf8.t TESTS some tests are now failing
mro/basic_03_c3_utf8.t TESTS some tests are now failing
mro/basic_04_c3_utf8.t TESTS TODO: Malformed UTF-8.
mro/dbic_c3_utf8.t TESTS Test results:
mro/next_NEXT.t SIG Exit signal is 11 SEGV
mro/vulcan_c3_utf8.t TESTS TODO: Malformed UTF-8.

The only thing that's suspicious is that op/write.t starts segfaulting instead of having a PLAN failure but I'm inclined to treat that as jitter for the moment.

@rurban
Copy link
Owner

rurban commented Oct 25, 2015

The code and idea looks good.
This is just a better replacement than the run-time eval.
Just the dumped_package{} hash set need to move after the mark_package.

toddr added a commit to cpanel/perl-compiler that referenced this issue Oct 27, 2015
GH rurban#285 Use the perl command in init2 after mro bootstraps.
toddr added a commit to cpanel/perl-compiler that referenced this issue Oct 28, 2015
GH rurban#285 Use the perl command in init2 after mro bootstraps.
toddr added a commit to cpanel/perl-compiler that referenced this issue Oct 28, 2015
GH rurban#285 Use the perl command in init2 after mro bootstraps.
toddr added a commit to cpanel/perl-compiler that referenced this issue Oct 28, 2015
GH rurban#285 Use the perl command in init2 after mro bootstraps.

(cherry picked from commit 5bcb0ce)
Signed-off-by: Todd Rinaldo <[email protected]>

Some extra xtestc breaks are listed but probably unrelated.
@toddr
Copy link
Collaborator Author

toddr commented Oct 28, 2015

PR #286 resolved this when it was merged to master.

@toddr toddr closed this as completed Oct 28, 2015
atoomic pushed a commit to cpanel/perl-compiler that referenced this issue Aug 9, 2016
GH rurban#285 Use the perl command in init2 after mro bootstraps.

(cherry picked from commit 5bcb0ce)
Signed-off-by: Todd Rinaldo <[email protected]>

Some extra xtestc breaks are listed but probably unrelated.
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