Return-Path: X-Original-To: apmail-perl-dev-archive@www.apache.org Delivered-To: apmail-perl-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EDFFA9CD4 for ; Wed, 9 May 2012 08:47:36 +0000 (UTC) Received: (qmail 73193 invoked by uid 500); 9 May 2012 08:47:36 -0000 Delivered-To: apmail-perl-dev-archive@perl.apache.org Received: (qmail 72863 invoked by uid 500); 9 May 2012 08:47:31 -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 72835 invoked by uid 99); 9 May 2012 08:47:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2012 08:47:30 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jkaluza@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2012 08:47:24 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q498l3oX020621 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 9 May 2012 04:47:03 -0400 Received: from dhcp-29-218.brq.redhat.com (dhcp-25-149.brq.redhat.com [10.34.25.149]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q498l1PU006561; Wed, 9 May 2012 04:47:01 -0400 Message-ID: <4FAA1F57.90708@redhat.com> Date: Wed, 09 May 2012 09:40:07 +0200 From: =?UTF-8?B?SmFuIEthbHXFvmE=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120424 Thunderbird/12.0 MIME-Version: 1.0 To: Fred Moyer CC: dev@perl.apache.org Subject: Re: mod_perl and httpd-2.4 References: <4F852843.6090007@redhat.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------030302050402070900000907" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Virus-Checked: Checked by ClamAV on apache.org --------------030302050402070900000907 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 05/08/2012 06:26 AM, Fred Moyer wrote: > On Tue, Apr 10, 2012 at 11:44 PM, Jan Kaluža wrote: >> I've talked with Torsten about the mod_perl and httpd-2.4 compatibility and >> he advised me to start discussion about this problem. >> >> Attached patch against httpd24 branch fixes the compilation with httpd-2.4. >> I was not able to generate xs using "make source_scan", so I've changed them >> manually. Should source_scan.pl work...? > > What changes to source_scan.pl did you have to make? So far I've the attached patch to compile mod_perl-2.0.6 against httpd-2.4. It's based on Stefan's patches. The only problem I have now is that after running source_scan and building mod_perl, ModPerl::Global is not included which causes later runtime failure. I'm not sure why it behaves like that and I'm in state of debugging this problem, but help is welcome. > > I've gotten httpd 2.4 to compile successfully, and I think this patch > will work in terms of the api changes, but it needs to provide the > appropriate method depending on the httpd minor version, remote_ip for > 2.0, 2.2 and client_ip for 2.4. I'm not sure where that happens yet in > the codebase - maybe FunctionTable.pm? Right, those patches only hardcodes it for httpd-2.4. The next step should be to probably put #ifdefs around remote_ip. Other things should be done by source_scan script I believe. > I would favor the compatibility layer approach personally. I have some > code on CPAN that uses remote_ip, so I don't really want to go change > that to support 2.4 just yet. If you find a way how to do it, tell me :). As I said, I think 90% of httpd modules uses remote_ip/remote_addr in the meaning of useragent_ip/useragent_addr. So, there's currently used conn_rec->remote_ip and new request_rec->useragent_ip. I can't imagine how would you write some layer to map current conn_rec->remote_ip to request_rec->remote_ip, since there's no way how to get particular request_rec from conn_rec. I just think it can't be done transparently and there will be need to change the modules anyway... Regards, Jan Kaluza --------------030302050402070900000907 Content-Type: text/x-patch; name="mod_perl-httpd24.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="mod_perl-httpd24.patch" diff --git a/lib/Apache2/ParseSource.pm b/lib/Apache2/ParseSource.pm index 8027548..f35c2a8 100644 --- a/lib/Apache2/ParseSource.pm +++ b/lib/Apache2/ParseSource.pm @@ -139,7 +139,8 @@ sub find_includes { apr_optional mod_include mod_cgi mod_proxy mod_ssl ssl_ apr_anylock apr_rmm ap_config mod_log_config - mod_perl modperl_ apreq); + mod_perl modperl_ apreq mod_cache + mod_serf mod_dav); $unwanted = qr|^$unwanted|; my $wanted = ''; @@ -280,6 +281,9 @@ my %enums_wanted = ( my $defines_unwanted = join '|', qw{ HTTP_VERSION APR_EOL_STR APLOG_MARK APLOG_NOERRNO APR_SO_TIMEOUT +APR_HOOK_PROBES_ENABLED APR_HOOK_INT_DCL_UD +APLOG_MAX_LOGLEVEL +APR_BEGIN_DECLS APR_END_DECLS }; sub get_constants { diff --git a/lib/ModPerl/CScan.pm b/lib/ModPerl/CScan.pm index 6789af3..a7314c9 100644 --- a/lib/ModPerl/CScan.pm +++ b/lib/ModPerl/CScan.pm @@ -943,7 +943,7 @@ sub new { my ($sym) = gensym; my $cmd = WIN32 ? "$Cpp->{cppstdin} $Defines $addincludes $Cpp->{cppflags} $filename |" : - "echo '\#include \"$filename\"' | $Cpp->{cppstdin} $Defines $addincludes $Cpp->{cppflags} $Cpp->{cppminus} |"; + "echo '\#include \"$filename\"' | $Cpp->{cppstdin} $Defines $addincludes $Cpp->{cppflags} $Cpp->{cppminus} | grep -v '^#' |"; #my $cmd = "echo '\#include <$filename>' | $Cpp->{cppstdin} $Defines $addincludes $Cpp->{cppflags} $Cpp->{cppminus} |"; (open($sym, $cmd) or die "Cannot open pipe from `$cmd': $!") diff --git a/lib/ModPerl/Code.pm b/lib/ModPerl/Code.pm index e43f77c..c58c87d 100644 --- a/lib/ModPerl/Code.pm +++ b/lib/ModPerl/Code.pm @@ -727,7 +727,7 @@ sub init_file { } my $file = "$self->{path}/$name"; - debug "generating...$file"; + print "generating...$file\n"; unlink $file; open my $fh, '>>', $file or die "open $file: $!"; print $fh @preamble, noedit_warning_c(); @@ -771,13 +771,13 @@ sub generate { if ($c_add) { print $c_fh $c_add; } - debug "$method...done"; + print "$method...done\n"; } $self->postamble; my $xsinit = "$self->{path}/modperl_xsinit.c"; - debug "generating...$xsinit"; + print "generating...$xsinit\n"; # There's a possibility that $Config{static_ext} may contain spaces # and ExtUtils::Embed::xsinit won't handle the situation right. In @@ -889,7 +889,8 @@ EOF if ($name eq 'DECLINE_CMD' || $name eq 'DIR_MAGIC_TYPE' || - $name eq 'CRLF') { + $name eq 'CRLF' || + $name eq 'CRLF_ASCII') { print $c_fh < 'all'; use ModPerl::MapUtil qw(); use ModPerl::ParseSource (); +use Data::Dumper; our @ISA = qw(ModPerl::MapBase); @@ -122,7 +123,6 @@ sub parse { for (keys %words) { $cur{$_} = $words{$_}; } - next; } @@ -175,6 +175,7 @@ sub parse { return_type => $return_type, alias => $alias, }; +# print "entry $entry=>{name}\n"; for (keys %cur) { $entry->{lc $_} = $cur{$_}; diff --git a/lib/ModPerl/MapUtil.pm b/lib/ModPerl/MapUtil.pm index 1aa219f..8ce0d79 100644 --- a/lib/ModPerl/MapUtil.pm +++ b/lib/ModPerl/MapUtil.pm @@ -20,6 +20,7 @@ use strict; use warnings; use Exporter (); use Apache2::Build (); +use Data::Dumper; our @EXPORT_OK = qw(list_first disabled_reason function_table structure_table @@ -180,7 +181,7 @@ sub map_files { next unless $file =~ /$wanted/i; } - #print "$package => $file\n"; +# print "$package => $file\n"; push @files, $file; } @@ -221,6 +222,7 @@ sub parse_map_files { close $fh; } +# print Data::Dumper::Dumper($map); return $map; } diff --git a/lib/ModPerl/WrapXS.pm b/lib/ModPerl/WrapXS.pm index 9114fc6..b062f1f 100644 --- a/lib/ModPerl/WrapXS.pm +++ b/lib/ModPerl/WrapXS.pm @@ -62,10 +62,13 @@ sub function_list { while (my ($name, $val) = each %{ $self->typemap->function_map }) { #entries that do not exist in C::Scan generated tables + print "bad $name\n" unless $name =~ /^DEFINE_/; next unless $name =~ /^DEFINE_/; + print "good $name\n"; push @list, $val; } +# print Data::Dumper::Dumper(@list); return \@list; } @@ -73,9 +76,12 @@ sub get_functions { my $self = shift; my $typemap = $self->typemap; +# print "exists\n" if defined $self->function_list()->{"mpxs_ModPerl__Global_special_list_call"}; +# print Data::Dumper::Dumper($self->function_list()); for my $entry (@{ $self->function_list() }) { my $func = $typemap->map_function($entry); - #print "FAILED to map $entry->{name}\n" unless $func; +# print "mapping $entry->{name}\n"; +# print "FAILED to map $entry->{name}\n" unless $func; next unless $func; my ($name, $module, $class, $args) = @@ -140,7 +146,8 @@ EOF else { if ($orig_args and @$orig_args == @$args) { #args were reordered - $parms = join ', ', @$orig_args; +# $parms = join ', ', @$orig_args; + $parms = $xs_parms; } $dispatch = $func->{name}; @@ -370,7 +377,7 @@ sub class_dir { unless (-d $dir) { mkpath [$dir], 0, 0755; - debug "mkdir.....$dir"; + print "mkdir.....$dir\n"; } $dir; @@ -398,7 +405,7 @@ sub open_class_file { my $name = $self->class_file($class, $file); open my $fh, '>', $name or die "open $name: $!"; - debug "writing...$name"; + print "writing...$name\n"; return $fh; } @@ -756,7 +763,7 @@ sub write_lookup_method_file { my $package = "ModPerl::MethodLookup"; my $file = catfile "lib", "ModPerl", "MethodLookup.pm"; - debug "creating $file"; + print "creating $file\n"; open my $fh, ">$file" or die "Can't open $file: $!"; my $noedit_warning = $self->ModPerl::Code::noedit_warning_hash(); @@ -1129,7 +1136,7 @@ sub write_module_versions_file { my $self = shift; my $file = catfile "lib", "ModPerl", "DummyVersions.pm"; - debug "creating $file"; + print "creating $file\n"; open my $fh, ">$file" or die "Can't open $file: $!"; my $noedit_warning = $self->ModPerl::Code::noedit_warning_hash(); @@ -1168,6 +1175,7 @@ sub generate { } $self->get_functions; + print Data::Dumper::Dumper($self->{XS}); $self->get_structures; $self->write_export_file('exp') if Apache2::Build::AIX; $self->write_export_file('def') if Apache2::Build::WIN32; @@ -1177,6 +1185,7 @@ sub generate { # if (-e "$self->{XS_DIR}/$root/$sub/$sub.xs") { # $module = join '::', $root, "Wrap$sub"; # } + print "test $module\n"; $self->write_makefilepl($module); $self->write_xs($module, $functions); $self->write_pm($module); diff --git a/src/modules/perl/modperl_apache_compat.h b/src/modules/perl/modperl_apache_compat.h index 78a9cb3..072ae79 100644 --- a/src/modules/perl/modperl_apache_compat.h +++ b/src/modules/perl/modperl_apache_compat.h @@ -68,7 +68,6 @@ AP_DECLARE(const char *) ap_get_server_version(void); #define MP_HTTPD_OVERRIDE_OPTS_UNSET (-1) #define MP_HTTPD_OVERRIDE_OPTS_DEFAULT (OPT_UNSET | \ OPT_ALL | \ - OPT_INCNOEXEC | \ OPT_SYM_OWNER | \ OPT_MULTI) diff --git a/src/modules/perl/modperl_apache_includes.h b/src/modules/perl/modperl_apache_includes.h index c93decc..4183782 100644 --- a/src/modules/perl/modperl_apache_includes.h +++ b/src/modules/perl/modperl_apache_includes.h @@ -23,6 +23,10 @@ #define CORE_PRIVATE #endif +#ifdef MP_IN_XS +#define AP_DEBUG_NO_ALLOC_POISON +#endif + #include "ap_mmn.h" #include "httpd.h" #include "http_config.h" @@ -34,9 +38,14 @@ #include "http_core.h" #include "http_vhost.h" #include "ap_mpm.h" +//#include "apu_errno.h" #include "util_filter.h" #include "util_script.h" +#ifndef MP_IN_XS +APLOG_USE_MODULE(perl); +#endif + #endif /* MODPERL_APACHE_INCLUDES_H */ diff --git a/src/modules/perl/modperl_interp.c b/src/modules/perl/modperl_interp.c index dfff32e..56bc820 100644 --- a/src/modules/perl/modperl_interp.c +++ b/src/modules/perl/modperl_interp.c @@ -500,7 +500,7 @@ modperl_interp_t *modperl_interp_select(request_rec *r, conn_rec *c, "set interp 0x%lx in %s 0x%lx (%s request for %s)\n", (unsigned long)interp, desc, (unsigned long)p, (r ? (is_subrequest ? "sub" : "main") : "conn"), - (r ? r->uri : c->remote_ip)); + (r ? r->uri : c->client_ip)); } /* set context (THX) for this thread */ diff --git a/src/modules/perl/modperl_module.c b/src/modules/perl/modperl_module.c index da148ca..f6a18b1 100644 --- a/src/modules/perl/modperl_module.c +++ b/src/modules/perl/modperl_module.c @@ -832,7 +832,7 @@ const char *modperl_module_add(apr_pool_t *p, server_rec *s, modperl_module_insert(modp); - ap_add_loaded_module(modp, p); + ap_add_loaded_module(modp, p, modp->name); apr_pool_cleanup_register(p, modp, modperl_module_remove, apr_pool_cleanup_null); diff --git a/t/response/TestAPI/add_config.pm b/t/response/TestAPI/add_config.pm index ff52cbc..c5f2d37 100644 --- a/t/response/TestAPI/add_config.pm +++ b/t/response/TestAPI/add_config.pm @@ -100,7 +100,6 @@ sub handler : method { my $expect = Apache2::Const::OPT_ALL | Apache2::Const::OPT_UNSET | - Apache2::Const::OPT_INCNOEXEC | Apache2::Const::OPT_MULTI | Apache2::Const::OPT_SYM_OWNER; diff --git a/t/response/TestAPI/aplog.pm b/t/response/TestAPI/aplog.pm index f2a4e19..1357311 100644 --- a/t/response/TestAPI/aplog.pm +++ b/t/response/TestAPI/aplog.pm @@ -93,7 +93,7 @@ sub handler { APR::Const::ENOTIME, "log_rerror test"); # can't match against the error string, since a locale may kick in ok t_cmp $logdiff->diff, - qr/\[crit\] .*?: log_rerror test/, + qr/\[\w*:crit\] \[pid[^]]+\] .*?: \[[^]]+\] log_rerror test/, '$r->log_rerror(LOG_MARK, LOG_CRIT, APR::Const::ENOTIME...)'; # log_error @@ -101,13 +101,13 @@ sub handler { t_server_log_error_is_expected(); $r->log_error('$r->log_error test'); ok t_cmp $logdiff->diff, - qr/\[error\] \$r->log_error test/, + qr/\[\w*:error\] \[pid[^]]+\] \$r->log_error test/, '$r->log_error(...)'; t_server_log_error_is_expected(); $s->log_error('$s->log_error test'); ok t_cmp $logdiff->diff, - qr/\[error\] \$s->log_error test/, + qr/\[\w*:error\] \[pid[^]]+\] \$s->log_error test/, '$s->log_error(...)'; } @@ -116,13 +116,13 @@ sub handler { t_server_log_error_is_expected(); $r->log_reason('$r->log_reason test'); ok t_cmp $logdiff->diff, - qr/\[error\] access to.*failed.*reason: \$r->log_reason test/, + qr/\[\w*:error\] \[pid[^]]+\] access to.*failed.*reason: \$r->log_reason test/, '$r->log_reason(msg)'; t_server_log_error_is_expected(); $r->log_reason('$r->log_reason filename test','filename'); ok t_cmp $logdiff->diff, - qr/\[error\] access to filename failed.*\$r->log_reason filename test/, + qr/\[\w*:error\] \[pid[^]]+\] access to filename failed.*\$r->log_reason filename test/, '$r->log_reason(msg, filename)'; } @@ -177,7 +177,7 @@ sub handler { t_server_log_warn_is_expected(); $s->warn('$s->warn test'); ok t_cmp $logdiff->diff, - qr/\[warn\] \$s->warn test/, + qr/\[\w*:warn\] \[pid[^]]+\] \$s->warn test/, '$s->warn()'; { @@ -185,7 +185,7 @@ sub handler { # this uses global server to get $s internally Apache2::ServerRec::warn("Apache2::ServerRec::warn test"); ok t_cmp $logdiff->diff, - qr/\[warn\] Apache2::ServerRec::warn test/, + qr/\[\w*:warn\] \[pid[^]]+\] Apache2::ServerRec::warn test/, 'Apache2::ServerRec::warn() w/o Apache2::RequestUtil->request '; Apache2::RequestUtil->request($r); @@ -193,14 +193,14 @@ sub handler { # this uses the global $r to get $s internally Apache2::ServerRec::warn("Apache2::ServerRec::warn test"); ok t_cmp $logdiff->diff, - qr/\[warn\] Apache2::ServerRec::warn test/, + qr/\[\w*:warn\] \[pid[^]]+\] Apache2::ServerRec::warn test/, 'Apache2::ServerRec::warn() w/ Apache2::RequestUtil->request '; } t_server_log_warn_is_expected(); warn "warn test"; ok t_cmp $logdiff->diff, - qr/\[warn\] warn test/, + qr/\[\w*:warn\] \[pid[^]]+\] warn test/, 'overriden via export warn()'; Apache2::Const::OK; diff --git a/xs/Apache2/Log/Apache2__Log.h b/xs/Apache2/Log/Apache2__Log.h index 1866315..f642a5d 100644 --- a/xs/Apache2/Log/Apache2__Log.h +++ b/xs/Apache2/Log/Apache2__Log.h @@ -48,13 +48,13 @@ static void mpxs_ap_log_error(pTHX_ int level, SV *sv, SV *msg) s = modperl_global_get_server_rec(); } - if ((lmask == APLOG_DEBUG) && (s->loglevel >= APLOG_DEBUG)) { + if ((lmask == APLOG_DEBUG) && (s->log.level >= APLOG_DEBUG)) { COP *cop = PL_curcop; file = CopFILE(cop); /* (caller)[1] */ line = CopLINE(cop); /* (caller)[2] */ } - if ((s->loglevel >= lmask) && + if ((s->log.level >= lmask) && SvROK(msg) && (SvTYPE(SvRV(msg)) == SVt_PVCV)) { dSP; ENTER;SAVETMPS; diff --git a/xs/Apache2/ServerUtil/Apache2__ServerUtil.h b/xs/Apache2/ServerUtil/Apache2__ServerUtil.h index e222c1b..f58c89d 100644 --- a/xs/Apache2/ServerUtil/Apache2__ServerUtil.h +++ b/xs/Apache2/ServerUtil/Apache2__ServerUtil.h @@ -162,8 +162,8 @@ SV *mpxs_Apache2__ServerRec_get_handlers(pTHX_ server_rec *s, #define mpxs_Apache2__ServerUtil_server(classname) modperl_global_get_server_rec() #if !defined(OS2) && !defined(WIN32) && !defined(BEOS) && !defined(NETWARE) -#define mpxs_Apache2__ServerUtil_user_id(classname) unixd_config.user_id -#define mpxs_Apache2__ServerUtil_group_id(classname) unixd_config.group_id +#define mpxs_Apache2__ServerUtil_user_id(classname) ap_unixd_config.user_id +#define mpxs_Apache2__ServerUtil_group_id(classname) ap_unixd_config.group_id #else #define mpxs_Apache2__ServerUtil_user_id(classname) 0 #define mpxs_Apache2__ServerUtil_group_id(classname) 0 diff --git a/xs/maps/modperl_types.map b/xs/maps/modperl_types.map index 3b02f02..8c6d541 100644 --- a/xs/maps/modperl_types.map +++ b/xs/maps/modperl_types.map @@ -7,6 +7,8 @@ struct modperl_filter_t | Apache2::OutputFilter SV * | SV I32 | IV I32 * | IV +U16 | UV +U16 * | UV U32 | UV U32 * | UV --------------030302050402070900000907 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 --------------030302050402070900000907--