Return-Path: Delivered-To: apmail-perl-dev-archive@www.apache.org Received: (qmail 64688 invoked from network); 6 Apr 2010 10:51:45 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 6 Apr 2010 10:51:45 -0000 Received: (qmail 78821 invoked by uid 500); 6 Apr 2010 10:51:45 -0000 Delivered-To: apmail-perl-dev-archive@perl.apache.org Received: (qmail 78639 invoked by uid 500); 6 Apr 2010 10:51:42 -0000 Mailing-List: contact dev-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@perl.apache.org Received: (qmail 78632 invoked by uid 99); 6 Apr 2010 10:51:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Apr 2010 10:51:41 +0000 X-ASF-Spam-Status: No, hits=-0.8 required=10.0 tests=AWL,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_FILL_THIS_FORM_SHORT,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of torsten.foertsch@gmx.net designates 213.165.64.20 as permitted sender) Received: from [213.165.64.20] (HELO mail.gmx.net) (213.165.64.20) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 06 Apr 2010 10:51:35 +0000 Received: (qmail invoked by alias); 06 Apr 2010 10:51:12 -0000 Received: from p57A5FBDC.dip.t-dialin.net (EHLO opi.localnet) [87.165.251.220] by mail.gmx.net (mp015) with SMTP; 06 Apr 2010 12:51:12 +0200 X-Authenticated: #1700068 X-Provags-ID: V01U2FsdGVkX1839cIuf3g3bVTzehUsisIjQi1VdXlQwyO0PM/gb9 b8YQtA+e1xwuAK From: Torsten =?iso-8859-1?q?F=F6rtsch?= To: dev@perl.apache.org Subject: what appeared to be a small typo Date: Tue, 6 Apr 2010 12:51:11 +0200 User-Agent: KMail/1.12.4 (Linux/2.6.31.12-0.2-desktop; KDE/4.3.5; x86_64; ; ) MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_fIxuLP5of7KmEbL" Message-Id: <201004061251.11919.torsten.foertsch@gmx.net> X-Y-GMX-Trusted: 0 X-FuHaFi: 0.42999999999999999 --Boundary-00=_fIxuLP5of7KmEbL Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, in modperl_filter.c my gcc gave a warning on this line: if (!init_handler->attrs & MP_FILTER_INIT_HANDLER) { Perl_croak(aTHX_ "handler %s doesn't have " "the FilterInitHandler attribute set", modperl_handler_name(init_handler)); } Without parentheses this is interpreted as if ((!init_handler->attrs) & MP_FILTER_INIT_HANDLER) { MP_FILTER_INIT_HANDLER is a constant, 0x8. So, the expression can be reduce= d=20 to "if (0)" or "if (1)" depending upon the numeric value of 1=3D=3D1. I thi= nk this=20 is not what is meant. Now, if I change the if to what I think is meant: if (!(init_handler->attrs & MP_FILTER_INIT_HANDLER)) { the test server won't even start: handler TestFilter::in_init_basic::suicide_init doesn't have the=20 =46ilterInitHandler attribute set. This is correct, the attrs field is 0. I think the culprit is the modperl_handler_new_from_sv function. It does no= t=20 set the attrs field. Any objections against this patch? Index: src/modules/perl/modperl_handler.c = =20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D = =20 =2D-- src/modules/perl/modperl_handler.c (revision 930668) = =20 +++ src/modules/perl/modperl_handler.c (working copy) = =20 @@ -497,6 +497,7 @@ = =20 { = =20 char *name =3D NULL; = =20 GV *gv; = =20 + modperl_handler_t *handler; = =20 = =20 if (SvROK(sv)) { = =20 sv =3D SvRV(sv); = =20 @@ -515,7 +516,10 @@ Perl_croak(aTHX_ "can't resolve the code reference"); } name =3D apr_pstrcat(p, HvNAME(GvSTASH(gv)), "::", GvNAME(gv), NUL= L); =2D return modperl_handler_new(p, apr_pstrdup(p, name)); + handler =3D modperl_handler_new(p, name); + handler->attrs=3D*modperl_code_attrs(aTHX_ (CV*)sv); + + return handler; default: break; }; Index: src/modules/perl/modperl_filter.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- src/modules/perl/modperl_filter.c (revision 930668) +++ src/modules/perl/modperl_filter.c (working copy) @@ -407,7 +407,9 @@ MP_TRACE_h(MP_FUNC, "found init handler %s", modperl_handler_name(init_handler)); =2D if (!init_handler->attrs & MP_FILTER_INIT_HANDLER) { + warn("init_attrs(%s)=3D%x\n", modperl_handler_name(init_handler= ), + init_handler->attrs); + if (!(init_handler->attrs & MP_FILTER_INIT_HANDLER)) { Perl_croak(aTHX_ "handler %s doesn't have " "the FilterInitHandler attribute set", modperl_handler_name(init_handler)); @@ -656,6 +658,10 @@ (void)SvUPGRADE(buffer, SVt_PV); SvPOK_only(buffer); SvCUR(buffer) =3D 0; + SvGROW(buffer, 1); /* make PERL_ARGS_ASSERT_SV_CATPVN_FLAGS + * happy, see Perl_sv_catpvn_flags() in sv.c + * of perl 5.10.1 + */ /* sometimes the EOS bucket arrives in the same brigade with other * buckets, so that particular read() will not return 0 and will The SvGROW thing was necessary due to perl 5.10.1 as the comment explains. = It=20 is not related to the attributes problem. I can commit it in a separate ste= p. The patch also eliminates the useless apr_strdup in name =3D apr_pstrcat(p, HvNAME(GvSTASH(gv)), "::", GvNAME(gv), NULL= ); return modperl_handler_new(p, apr_pstrdup(p, name)); Torsten F=F6rtsch =2D-=20 Need professional modperl support? Hire me! (http://foertsch.name) Like fantasy? http://kabatinte.net --Boundary-00=_fIxuLP5of7KmEbL Content-Type: text/x-patch; charset="UTF-8"; name="handler_attrs.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="handler_attrs.patch" Index: src/modules/perl/modperl_handler.c =================================================================== --- src/modules/perl/modperl_handler.c (revision 930668) +++ src/modules/perl/modperl_handler.c (working copy) @@ -497,6 +497,7 @@ { char *name = NULL; GV *gv; + modperl_handler_t *handler; if (SvROK(sv)) { sv = SvRV(sv); @@ -515,7 +516,10 @@ Perl_croak(aTHX_ "can't resolve the code reference"); } name = apr_pstrcat(p, HvNAME(GvSTASH(gv)), "::", GvNAME(gv), NULL); - return modperl_handler_new(p, apr_pstrdup(p, name)); + handler = modperl_handler_new(p, name); + handler->attrs=*modperl_code_attrs(aTHX_ (CV*)sv); + + return handler; default: break; }; Index: src/modules/perl/modperl_filter.c =================================================================== --- src/modules/perl/modperl_filter.c (revision 930668) +++ src/modules/perl/modperl_filter.c (working copy) @@ -407,7 +407,9 @@ MP_TRACE_h(MP_FUNC, "found init handler %s", modperl_handler_name(init_handler)); - if (!init_handler->attrs & MP_FILTER_INIT_HANDLER) { + warn("init_attrs(%s)=%x\n", modperl_handler_name(init_handler), + init_handler->attrs); + if (!(init_handler->attrs & MP_FILTER_INIT_HANDLER)) { Perl_croak(aTHX_ "handler %s doesn't have " "the FilterInitHandler attribute set", modperl_handler_name(init_handler)); @@ -656,6 +658,10 @@ (void)SvUPGRADE(buffer, SVt_PV); SvPOK_only(buffer); SvCUR(buffer) = 0; + SvGROW(buffer, 1); /* make PERL_ARGS_ASSERT_SV_CATPVN_FLAGS + * happy, see Perl_sv_catpvn_flags() in sv.c + * of perl 5.10.1 + */ /* sometimes the EOS bucket arrives in the same brigade with other * buckets, so that particular read() will not return 0 and will --Boundary-00=_fIxuLP5of7KmEbL Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org For additional commands, e-mail: dev-help@perl.apache.org --Boundary-00=_fIxuLP5of7KmEbL--