Bug#1107289: Apache2 2.4.63-1 has a failing test in its test suite

Thomas Ward <[email protected]> Wed, 4 Jun 2025 14:50:24 -0400
Newsgroups gmane.linux.debian.devel.apache
Message-ID <[email protected]>
Source: apache2
Tags: fixed-upstream patch
Version: 2.4.63-1
Severity: normal

Discovered downstream in Ubuntu during migration tests.

Downstream bug: https://bugs.launchpad.net/bugs/2112429

------

Downstream bug summary:

Discovered through update_excuses and confirmed locally in an LXD 
autopkgtest container (from 
https://github.com/canonical/ubuntu-maintainers-handbook/blob/main/PackageTests.md 
<https://github.com/canonical/ubuntu-maintainers-handbook/blob/main/PackageTests.md> 
to create it), the autopkgtests on 2.4.63-1ubuntu2 fail for apache2's 
test suite.

It fails on debian/perl-framework/t/apache/pr64339.t, test #12 which 
makes sure certain content is rendered by xml2enc's backend components.

I followed every single step and reproduced in a pure LXD container with 
the apache2 binaries in proposed.

With this in mind, the following is the specific items in the test at fault:

EXPECTED: response from looking at 
http://localhost:8529/modules/xml2enc/front/doc.isohtml 
<http://localhost:8529/modules/xml2enc/front/doc.isohtml> with a GET 
call is "<html><body><p>fóó\n</p></body></html>" and is UTF-8 encoded

ACTUAL: response from looking at 
http://localhost:8529/modules/xml2enc/front/doc.isohtml 
<http://localhost:8529/modules/xml2enc/front/doc.isohtml> with a GET 
call is "<html><body>fóó\n</body></html>"

There is a changelog that introduces this test via a pull request:
   *) mod_xml2enc: Update check to accept any text/ media type
      or any XML media type per RFC 7303, avoiding
      corruption of Microsoft OOXML formats. PR 64339.
      [Joseph Heenan joseph.heenan fintechlabs.io, Joe Orton]

... in 2.4.59 in April 2024. At the time the test was written, Apache 
was using libxml2 and the 2.12 branch.

After examining the Apache code (modules/filters/mod_xml2enc.c), it 
calls htmlParser which is part of libxml2.

Using HTMLParser from python3-lxml (which is libxml2 wrappings for 
Python), I went through the decoding process of 
perl-framework/t/htdocs/modules/xml2enc/doc.isohtml which is what is 
used during the test suite during t/apache/pr64339.t, I was able to 
determine that libxml2's parser outputs the value observed in teh 
failing test - namely "<html><body>fóó\n</body></html>" - which 
indicates this is a libxml2 change.

------

Downstream in Ubuntu, it is simple enough to patch the tests with the 
attached diff which corresponds to commit 1925450 in upstream test suites.

I looked at the Debian source and the flawed test still exists. This 
should be patched in Debian.


Thomas
r1925450.diff (text/plain, 903 B)
Index: t/apache/pr64339.t
===================================================================
--- t/apache/pr64339.t (revision 1925449)
+++ t/apache/pr64339.t (revision 1925450)
@@ -18,7 +18,7 @@
     ['/doc.notxml', "application/notreallyxml", "f\xf3\xf3\n" ],

     # Sent with charset=ISO-8859-1 - should be transformed to utf-8
- ['/doc.isohtml', "text/html;charset=utf-8", "<html><body><p>fóó\n</p></body></html>" ],
+ ['/doc.isohtml', "text/html;charset=utf-8", "<html><body>.*fóó\n.*</body></html>" ],
 );

 # mod_xml2enc on trunk behaves quite differently to the 2.4.x version
@@ -42,5 +42,5 @@

     ok t_cmp($r->code, 200, "fetching ".$t->[0]);
     ok t_cmp($r->header('Content-Type'), $t->[1], "content-type header test for ".$t->[0]);
- ok t_cmp($r->content, $t->[2], "content test for ".$t->[0]);
+ ok t_cmp($r->content, qr/$t->[2]/, "content test for ".$t->[0]);
 }