Page MenuHomePhorge

Problem receiveing some emails
Closed, InvalidPublic

Description

Most of the emails I receive are now getting through, but some are getting 'stuck' in the following wallace directories (on AlmaLinux 9) and so do not appear in the users mail folders:

  • /var/spool/pykolab/wallace/invitationpolicy/incoming/
  • /var/spool/pykolab/wallace/resources/incoming/

The files that are getting stuck in these directories appear to be generating the following type of crash dumps in the /var/log/kolab/pykolab.log file:

2024-04-17 16:17:06,311 pykolab.wallace/modules ERROR [1329] - Module 'resources' - Unknown error occurred; UnicodeDecodeError('utf-8', b'X-Kolab-From: <<...>>', 4188, 4189, 'invalid start byte')
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/wallace/modules.py", line 127, in execute
    return modules[name]['function'](*args, **kw)
  File "/usr/lib/python3.9/site-packages/wallace/module_resources.py", line 190, in execute
    message = Parser().parse(open(filepath, 'r'))
  File "/usr/lib64/python3.9/email/parser.py", line 53, in parse
    data = fp.read(8192)
  File "/usr/lib64/python3.9/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 4188: invalid start byte

Exporting one of problem files to my local machine, I can re-create the problem thus:

>>> from email.parser import Parser
>>> message = Parser().parse(open("/home/mike/Downloads/tmpfep6d5ue",'r'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.11/email/parser.py", line 53, in parse
    data = fp.read(8192)
           ^^^^^^^^^^^^^
  File "<frozen codecs>", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 4188: invalid start byte

Specifying a specific encoding seems to enable the parser to run without issue:

>>> message = Parser().parse(open("/home/mike/Downloads/tmpfep6d5ue",'r', encoding='latin_1'))
>>>

While it appears that specifying the encode as above stop the crash, I'm not sure if this is the full or correct answer as it won't cover emails sent using a non-Western European character set.

I have package wallace-0.9.0.6-1.3.el9.kolab_16.noarch installed.

Details

Ticket Type
Task