diff options
5 files changed, 258 insertions, 6 deletions
diff --git a/testing/apache2-mod-perl/APKBUILD b/testing/apache2-mod-perl/APKBUILD index ba746f0528..bfdd5587a7 100644 --- a/testing/apache2-mod-perl/APKBUILD +++ b/testing/apache2-mod-perl/APKBUILD @@ -4,7 +4,7 @@ pkgname=apache2-mod-perl _pkgreal=mod_perl pkgver=2.0.10 -pkgrel=2 +pkgrel=3 pkgdesc="Perl Module for Apache2" url="https://perl.apache.org/" arch="all" @@ -14,6 +14,10 @@ depends_dev="$pkgname" makedepends="apache2-dev perl-dev perl-linux-pid apr-dev apr-util-dev" subpackages="$pkgname-doc $pkgname-dev" source="https://www-eu.apache.org/dist/perl/$_pkgreal-$pkgver.tar.gz + mod_perl-2.0.10-http_syntax.patch + mod_perl-2.0.10-inject_header_line_terminators.patch + mod_perl-2.0.10-restrict_perl_section_to_server_scope.patch + mod_perl-2.0.7-fix_pipelines_reponse_deadlock_in_tests.patch $pkgname.conf" builddir="$srcdir/$_pkgreal-$pkgver" @@ -27,7 +31,7 @@ build() { check() { cd "$builddir" - make test + make -j1 test } @@ -50,9 +54,9 @@ dev() { "$subpkgdir"/usr/lib/perl5/vendor_perl/auto/Apache2 } -md5sums="cef55e715b5770a63b3becbe9d271121 mod_perl-2.0.10.tar.gz -326cad2b2324c4a59fde4c232e8465b1 apache2-mod-perl.conf" -sha256sums="d1cf83ed4ea3a9dfceaa6d9662ff645177090749881093051020bf42f9872b64 mod_perl-2.0.10.tar.gz -02b359afff4da0c4a94cc2c253505f301f8b4fca5a14655fdd846f07cbd33530 apache2-mod-perl.conf" sha512sums="0bf1a885cb32a3393e95f87e71983097613e263b9052dbf22494663b506e36a25d0256afed24285232276d9f43ebd3adaa18b91129bfb62116a8ccb023855bca mod_perl-2.0.10.tar.gz +bd4d84d4f464edaa59d514e604e3f33a7f7504084cb9f36ecff76a952cb2af1278185defdc2ad44bbc9f762bdfaabcca942808cf016ba5370e010db9f164f837 mod_perl-2.0.10-http_syntax.patch +5ad666766994116c59569581c5e9e09cec17e4122348885f639be1ad0a0efe57ba6694fd11af3acad9f66c85432f864dc627f2a6ee2cee4ead61a2e27af2c33f mod_perl-2.0.10-inject_header_line_terminators.patch +efc80b02b405f05dc1ed7648d7b838d09222049ce7e5487f50052c65c57ea6418a39e5abebc15e5a3cc670a10f0e80749cac0488961d71fa13b9dc86919f4400 mod_perl-2.0.10-restrict_perl_section_to_server_scope.patch +4529097462c5deb40ca548c91776638118a4ec7e2701e5b2b9c89dc0cf116574bcd2f5115afccc192a4cfd906916bc0a13489f4d77e9fe6d05c6017eb3c04004 mod_perl-2.0.7-fix_pipelines_reponse_deadlock_in_tests.patch 15a430ce597e370997a08d6aa1b5e55d4fa723ecac031fe39906c8cc767b90d5bf63e3026dfaa8b10ae8b09a17832f4f07cb8b2fdcd6c9ef427edfaf4e8a48b0 apache2-mod-perl.conf" diff --git a/testing/apache2-mod-perl/mod_perl-2.0.10-http_syntax.patch b/testing/apache2-mod-perl/mod_perl-2.0.10-http_syntax.patch new file mode 100644 index 0000000000..465d0c4e2a --- /dev/null +++ b/testing/apache2-mod-perl/mod_perl-2.0.10-http_syntax.patch @@ -0,0 +1,33 @@ +From 4a803fdb4c9eae8538293fe31c9222eecb6465be Mon Sep 17 00:00:00 2001 +From: Niko Tyni <ntyni@debian.org> +Date: Fri, 23 Dec 2016 18:27:23 +0200 +Subject: [PATCH 1/2] Fix t/apache/read.t HTTP syntax for Apache 2.4.24 + compatibility + +HTTP/1.1 RFC 7230, section 2.6. "Protocol Versioning" says the HTTP name +is case sensitive. Starting with Apache 2.4.24, using lower case will +make the server issue a 400 Bad request response, causing a test failure. + +https://tools.ietf.org/html/rfc7230#section-2.6 + +Bug-Debian: https://bugs.debian.org/849082 +--- + t/apache/read.t | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/t/apache/read.t b/t/apache/read.t +index 83670c9..9f7f504 100644 +--- a/t/apache/read.t ++++ b/t/apache/read.t +@@ -24,7 +24,7 @@ close $fh; + + my $size = length $data; + +-for my $string ("POST $location http/1.0", ++for my $string ("POST $location HTTP/1.0", + "Content-length: $size", + "") { + my $line = "$string\r\n"; +-- +2.11.0 + diff --git a/testing/apache2-mod-perl/mod_perl-2.0.10-inject_header_line_terminators.patch b/testing/apache2-mod-perl/mod_perl-2.0.10-inject_header_line_terminators.patch new file mode 100644 index 0000000000..daaab51dcb --- /dev/null +++ b/testing/apache2-mod-perl/mod_perl-2.0.10-inject_header_line_terminators.patch @@ -0,0 +1,45 @@ +From d59229cf4f5b91ed58e25e27977e76f59096b72d Mon Sep 17 00:00:00 2001 +From: Niko Tyni <ntyni@debian.org> +Date: Sat, 24 Dec 2016 23:07:28 +0200 +Subject: [PATCH 2/2] Fix in_bbs_inject_header line terminators for Apache + 2.4.24 compatibility + +rfc7230 3.5 says: + + Although the line terminator for the start-line and header fields is + the sequence CRLF, a recipient MAY recognize a single LF as a line + terminator and ignore any preceding CR. + +Apache with strict enabled chooses not to implement the MAY. + +Author: Stefan Fritsch <sf@sfritsch.de> +Bug-Debian: https://bugs.debian.org/849082 +--- + t/filter/TestFilter/in_bbs_inject_header.pm | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/t/filter/TestFilter/in_bbs_inject_header.pm b/t/filter/TestFilter/in_bbs_inject_header.pm +index b09d6f9..5380c65 100644 +--- a/t/filter/TestFilter/in_bbs_inject_header.pm ++++ b/t/filter/TestFilter/in_bbs_inject_header.pm +@@ -181,7 +181,7 @@ sub handler : FilterConnectionHandler { + + if ($data and $data =~ /^POST/) { + # demonstrate how to add a header while processing other headers +- my $header = "$header1_key: $header1_val\n"; ++ my $header = "$header1_key: $header1_val\r\n"; + push @{ $ctx->{buckets} }, APR::Bucket->new($c->bucket_alloc, $header); + debug "queued header [$header]"; + } +@@ -199,7 +199,7 @@ sub handler : FilterConnectionHandler { + # we hit the headers and body separator, which is a good + # time to add extra headers: + for my $key (keys %headers) { +- my $header = "$key: $headers{$key}\n"; ++ my $header = "$key: $headers{$key}\r\n"; + push @{ $ctx->{buckets} }, APR::Bucket->new($c->bucket_alloc, $header); + debug "queued header [$header]"; + } +-- +2.11.0 + diff --git a/testing/apache2-mod-perl/mod_perl-2.0.10-restrict_perl_section_to_server_scope.patch b/testing/apache2-mod-perl/mod_perl-2.0.10-restrict_perl_section_to_server_scope.patch new file mode 100644 index 0000000000..79dc46cfae --- /dev/null +++ b/testing/apache2-mod-perl/mod_perl-2.0.10-restrict_perl_section_to_server_scope.patch @@ -0,0 +1,62 @@ +From jani@ulrik.uio.no Wed Oct 05 09:38:47 2011 +To: 644169@bugs.debian.org +Subject: Re: Bug#644169: libapache2-mod-perl2: PerlOptions -Sections not + permitted in server config, but should be +From: Jan Ingvoldstad <jani+debian-2011+@ifi.uio.no> +Date: Wed, 05 Oct 2011 11:38:37 +0200 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset=utf-8 + +Here is a patch that ensures that <Perl> (and Pod) sections are only +allowed in the server configuration and not per directory, which +incidentally matches the specification table here: + +http://perl.apache.org/docs/2.0/user/config/config.html#mod_perl_Directives_Argument_Types_and_Allowed_Location + +The patch has been tested on the same system where I identified the +problem. + +The patch solves the issue for me, and leaves only the following +issues, as far as I can tell: + + - Should there be fine-grained control as "PerlOptions -Sections" + implies or not? + + - The mod_perl documentation (online and in the module) probably + needs to be changed to reflect that PerlOptions -Sections does not + work. + +Description: allow Perl and Pod sections only in server config +Author: Jan Ingvoldstad <jani+debian-mod-perl-2011+@ifi.uio.no> +Last-Update: 2011-10-05 +--- a/src/modules/perl/mod_perl.c 2011-02-02 21:23:45.000000000 +0100 ++++ b/src/modules/perl/mod_perl.c 2011-10-05 11:05:52.977576861 +0200 +@@ -913,18 +913,18 @@ + MP_CMD_DIR_ITERATE2("PerlAddVar", add_var, "PerlAddVar"), + MP_CMD_DIR_TAKE2("PerlSetEnv", set_env, "PerlSetEnv"), + MP_CMD_SRV_TAKE1("PerlPassEnv", pass_env, "PerlPassEnv"), +- MP_CMD_DIR_RAW_ARGS_ON_READ("<Perl", perl, "Perl Code"), +- MP_CMD_DIR_RAW_ARGS("Perl", perldo, "Perl Code"), ++ MP_CMD_SRV_RAW_ARGS_ON_READ("<Perl", perl, "Perl Code"), ++ MP_CMD_SRV_RAW_ARGS("Perl", perldo, "Perl Code"), + + MP_CMD_DIR_TAKE1("PerlSetInputFilter", set_input_filter, + "filter[;filter]"), + MP_CMD_DIR_TAKE1("PerlSetOutputFilter", set_output_filter, + "filter[;filter]"), + +- MP_CMD_DIR_RAW_ARGS_ON_READ("=pod", pod, "Start of POD"), +- MP_CMD_DIR_RAW_ARGS_ON_READ("=back", pod, "End of =over"), +- MP_CMD_DIR_RAW_ARGS_ON_READ("=cut", pod_cut, "End of POD"), +- MP_CMD_DIR_RAW_ARGS_ON_READ("__END__", END, "Stop reading config"), ++ MP_CMD_SRV_RAW_ARGS_ON_READ("=pod", pod, "Start of POD"), ++ MP_CMD_SRV_RAW_ARGS_ON_READ("=back", pod, "End of =over"), ++ MP_CMD_SRV_RAW_ARGS_ON_READ("=cut", pod_cut, "End of POD"), ++ MP_CMD_SRV_RAW_ARGS_ON_READ("__END__", END, "Stop reading config"), + + MP_CMD_SRV_RAW_ARGS("PerlLoadModule", load_module, "A Perl module"), + #ifdef MP_TRACE + + + diff --git a/testing/apache2-mod-perl/mod_perl-2.0.7-fix_pipelines_reponse_deadlock_in_tests.patch b/testing/apache2-mod-perl/mod_perl-2.0.7-fix_pipelines_reponse_deadlock_in_tests.patch new file mode 100644 index 0000000000..d274ff7341 --- /dev/null +++ b/testing/apache2-mod-perl/mod_perl-2.0.7-fix_pipelines_reponse_deadlock_in_tests.patch @@ -0,0 +1,108 @@ +Fix pipelined response deadlock in tests + +There's a race condition that can cause mod_perl's test suite to hang +in t/filter/in_str_declined.t. The problem is that the response handler +starts generating response body, and so triggers header output, before +it reads the request body. If LWP::Protocol::http, which is the client +for this test, receives a complete set of response headers, it will stop +sending the request body. (However, if the request body is no more than +8192 octets then it will send the whole body before it starts looking +for a response. The failure only shows up with an appreciably large +request body.) + +RFC 2616 doesn't explicitly address this sort of pipelining, but the +start of section 6 does say "After receiving and interpreting a request +message, a server responds with an HTTP response message.", which can be +read as prohibiting sending any part of the response before the entire +request has been received. + +The attached patch fixes this issue by making all the POST handlers in +the test suite read the body before doing anything that generates output +(specifically plan()). + +-zefram + +CPAN RT#82409 +Debian bug #676754 + +--- a/t/filter/TestFilter/in_str_declined.pm 2011-02-08 02:00:11.000000000 +0000 ++++ b/t/filter/TestFilter/in_str_declined.pm 2013-01-04 16:08:14.000000000 +0000 +@@ -35,13 +35,17 @@ + sub response { + my $r = shift; + ++ my $data; ++ if ($r->method_number == Apache2::Const::M_POST) { ++ # consume the data so the input filter is invoked ++ $data = TestCommon::Utils::read_post($r); ++ } ++ + plan $r, tests => 2; + + $r->content_type('text/plain'); + + if ($r->method_number == Apache2::Const::M_POST) { +- # consume the data so the input filter is invoked +- my $data = TestCommon::Utils::read_post($r); + ok t_cmp(length $data, 20000, "the request body received ok"); + } + +--- a/t/filter/TestFilter/in_str_declined_read.pm 2011-02-08 02:00:11.000000000 +0000 ++++ b/t/filter/TestFilter/in_str_declined_read.pm 2013-01-04 16:06:28.000000000 +0000 +@@ -31,14 +31,19 @@ + sub response { + my $r = shift; + ++ my $err; ++ if ($r->method_number == Apache2::Const::M_POST) { ++ # this should fail, because of the failing filter ++ eval { TestCommon::Utils::read_post($r) }; ++ $err = $@; ++ } ++ + plan $r, tests => 1; + + $r->content_type('text/plain'); + + if ($r->method_number == Apache2::Const::M_POST) { +- # this should fail, because of the failing filter +- eval { TestCommon::Utils::read_post($r) }; +- ok $@; ++ ok $err; + } + + Apache2::Const::OK; +--- a/t/filter/TestFilter/in_str_msg.pm 2011-02-08 02:00:11.000000000 +0000 ++++ b/t/filter/TestFilter/in_str_msg.pm 2013-01-04 16:08:27.000000000 +0000 +@@ -76,10 +76,10 @@ + sub response { + my $r = shift; + +- plan $r, tests => 1; +- + my $received = TestCommon::Utils::read_post($r); + ++ plan $r, tests => 1; ++ + ok t_cmp($received, $expected, + "request filter must have upcased the data"); + +--- a/t/response/TestModperl/post_utf8.pm 2011-02-08 02:00:12.000000000 +0000 ++++ b/t/response/TestModperl/post_utf8.pm 2013-01-04 16:04:39.000000000 +0000 +@@ -29,14 +29,14 @@ + # $r->content_type("text/plain; charset=utf-8"); + # $r->print("expected: $expected_utf8\n"); + ++ my $received = TestCommon::Utils::read_post($r) || ""; ++ + # utf encode/decode was added only in 5.8.0 + # XXX: currently binmode is only available with perlio (used on the + # server side on the tied/perlio STDOUT) + plan $r, tests => 2, + need need_min_perl_version(5.008), need_perl('perlio'); + +- my $received = TestCommon::Utils::read_post($r) || ""; +- + # workaround for perl-5.8.0, which doesn't decode correctly a + # tainted variable + require ModPerl::Util; |