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
Magical change in perl >= 5.21.7? #14449
Comments
From @steve-m-hayTesting modperl (svn trunk, not the current CPAN release) with httpd-2.4.10 and recent 5.21.x perls I find that things look ok up to and including 5.21.6, but the mod_perl-enabled server fails to start with 5.21.7 and 5.21.8. This function in modperl_util.c is where things go wrong: U16 *modperl_code_attrs(pTHX_ CV *cv) { if (!SvMAGICAL(cv)) { mg = mg_find((SV*)cv, PERL_MAGIC_ext); The cv passed in comes from cv = get_cv(name, FALSE) where name is "main::add_my_version". SvMAGICAL(cv) is true so sv_magic() is not called, and then mg_find() returns NULL and things all go wrong from there. The "main::add_my_version" in question is this in modperl_extra.pl: sub test_add_version_component { sub add_my_version { If I move sub add_my_version {} outside of sub test_add_version_component {} like this: sub test_add_version_component { sub add_my_version { then SvMAGICAL(cv) is now false so sv_magic() is called, and then mg_find() returns non-NULL and all is well. Is this an expected change in behaviour between 5.21.6 and 5.21.7 that mod_perl needs to keep up with, or a bug in 5.21.7? (I haven't tried the latest bleadperl yet, but I don't see anything since 5.21.8 that looks like it would affect this.) |
From @steve-m-hayThe change in behaviour can be seen with the attached XS module. |
From [Unknown Contact. See original ticket]The change in behaviour can be seen with the attached XS module. |
From @LeontOn Tue, Jan 27, 2015 at 3:15 PM, Steve Hay <perlbug-followup@perl.org>
The code is naive at best. It is assuming there is no magic on the cv from U16 *modperl_code_attrs(pTHX_ CV *cv) { if (!(SvMAGICAL(cv) && mg = mg_find((SV*)cv, PERL_MAGIC_ext))) { return &(mg->mg_private); Actually, you may prefer to use mg_findext and an explicit vtable (even if Leon |
The RT System itself - Status changed from 'new' to 'open' |
From @tonycozOn Tue Jan 27 14:52:38 2015, LeonT wrote:
I had something pretty similar to this written up when I saw your post, but I do wonder... PERL_DL_NONLAZY=1 "/home/tony/perl/blead/bin/perl5.21.8" "-Iblib/lib" "-Iblib/arch" test.pl why the reference started getting backref magic. Tony |
From @steve-m-hayThank you both for your helpful replies.I should have realized what the cause of the problem there was, but I wouldn't have known whether that was an intentional change in perl or not. The suggested fix (plus some extra parens) did the trick: |
@steve-m-hay - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#123683 (status was 'resolved')
Searchable as RT123683$
The text was updated successfully, but these errors were encountered: