Modify ↓
Opened 4 years ago
Closed 4 years ago
#13340 closed defect (cantfix)
Too long line in part with `Content-Transfer-Encoding: base64` in notification mail
Reported by: | Jun Omae | Owned by: | Jun Omae |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | notification | Version: | 1.5.2 |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
unit-test with r17497 fails on my environment.
====================================================================== FAIL: test_mimebody_b64 (trac.ticket.tests.notification.NotificationTestCase) MIME Base64/utf-8 encoding ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jun66j5/src/tracdev/git/trac/ticket/tests/notification.py", line 721, in test_mimebody_b64 ticket, True) File "/home/jun66j5/src/tracdev/git/trac/ticket/tests/notification.py", line 848, in _validate_mimebody self.assertTrue(len(line) <= MAXBODYWIDTH) AssertionError: False is not true ----------------------------------------------------------------------
I applied the following changes to investigate the failure.
-
trac/ticket/tests/notification.py
diff --git a/trac/ticket/tests/notification.py b/trac/ticket/tests/notification.py index dae1da8f9..0cc0b64fc 100644
a b class NotificationTestCase(unittest.TestCase): 844 844 self.assertEqual(mime_charset, charset) 845 845 self.assertEqual(headers['Content-Transfer-Encoding'], mime_name) 846 846 # checks the width of each body line 847 for line in body.splitlines(): 848 self.assertTrue(len(line) <= MAXBODYWIDTH) 847 for idx, line in enumerate(body.splitlines()): 848 self.assertTrue(len(line) <= MAXBODYWIDTH, 849 'Line %d too long (%d > %d, %r)' % 850 (idx + 1, len(line), MAXBODYWIDTH, line)) 849 851 # attempts to decode the body, following the specified MIME encoding 850 852 # and charset 851 853 try:
After the changes, I get the following message. Body encoded with base64 has line exceeded 76 characters. That's weird.
====================================================================== FAIL: test_mimebody_b64 (trac.ticket.tests.notification.NotificationTestCase) MIME Base64/utf-8 encoding ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jun66j5/src/tracdev/git/trac/ticket/tests/notification.py", line 721, in test_mimebody_b64 ticket, True) File "/home/jun66j5/src/tracdev/git/trac/ticket/tests/notification.py", line 850, in _validate_mimebody (idx + 1, len(line), MAXBODYWIDTH, line)) AssertionError: False is not true : Line 1 too long (80 > 76, 'IzE6IFRoaXMgaXMgYSBsb25nIGVub3VnaCBzdW1tYXJ5IHRvIGNhdXNlIFRyYWMgdG8gZ2VuZXJhdA==') ----------------------------------------------------------------------
Attachments (0)
Change History (1)
comment:1 by , 4 years ago
Milestone: | 1.5.3 |
---|---|
Resolution: | → cantfix |
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
It is able to reproduce with small code:
Output:
I noticed it occurs only with Python 3.5.2 (Ubuntu 16.04LTS). It doesn't occur with Python 3.6.12, 3.7.9, 3.8.7, 3.9.1 and 3.10.0a3.
Investigating, I found https://bugs.python.org/issue28047 related to the issue and it has been fixed in https://hg.python.org/cpython/rev/99db6a25444b (Python 3.5.3). I confirmed fixed with Python 3.5.4 on Windows.
Going to close as cantfix….