This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lukasz.langa
Recipients lukasz.langa
Date 2021-07-15.17:50:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1626371420.43.0.163040134112.issue44647@roundup.psfhosted.org>
In-reply-to
Content
GH-23638 introduced a new test for Accept: headers in CGI HTTP servers. This test serializes all of `os.environ` on the server side.  For non-UTF8 locales this can fail for some Unicode characters found in environment variables.

This started failing this week on Azure Pipelines with their rollout of a new Windows 2019 image version that included a "BUILD_SOURCEVERSIONAUTHOR" env variable. For me specifically it includes a leading Unicode character so all my PRs started failing on Azure Pipelines Windows 2019 alone.

The result was truncated output from the CGI HTTP server, like:

======================================================================
FAIL: test_accept (test.test_httpservers.CGIHTTPServerTestCase) [OrderedDict([('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')])]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\1\s\lib\test\test_httpservers.py", line 860, in test_accept
    self.assertIn(expected.encode('ascii'), res.read())
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: b"'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'" not found in b''


The root cause is that the CGI script in question (`cgi_file6` in test_httpservers.py) is crashing on server-side reaching the `print(repr(os.environ))` line. However, this exception isn't visible on the client side where the test is running. The only visible issue is truncated output.

I suggest adding ENSURE_UNICODE_WORKS=Łukasz to the testing env so that this never regresses.
History
Date User Action Args
2021-07-15 17:50:20lukasz.langasetrecipients: + lukasz.langa
2021-07-15 17:50:20lukasz.langasetmessageid: <1626371420.43.0.163040134112.issue44647@roundup.psfhosted.org>
2021-07-15 17:50:20lukasz.langalinkissue44647 messages
2021-07-15 17:50:20lukasz.langacreate