Skip to content

Fails to deal with newly PGP-signed accepted mails

Dak changed its "Accepted" mails to include a PGP signature as attachment. This broke distro-tracker.

Here's an example mail that can be used to create a unit test: signed-dak-mail.txt

We probably want to add some unit test in distro_tracker.debian.vendor.tests but the fix will likely be in distro_tracker/core/models.py. We might want some unit test there ensuring that we deal properly with multi-part emails.

The stack trace that we currently hit is this one:

2022-08-27 23:37:56,762 [processor/3102460/140016998332160] ERROR: Failed to process incoming mail /srv/tracker.debian.org/data/maildir/new/1661629826.H140978P3063078.ticharich.debian.org
Traceback (most recent call last):
  File "/srv/tracker.debian.org/distro-tracker/distro_tracker/mail/processor.py", line 187, in run_mail_processor
    processor.process()
  File "/srv/tracker.debian.org/distro-tracker/distro_tracker/mail/processor.py", line 140, in process
    self.handle_dispatch(package, keyword)
  File "/srv/tracker.debian.org/distro-tracker/distro_tracker/mail/processor.py", line 171, in handle_dispatch
    distro_tracker.mail.dispatch.process(self.message, package=package,
  File "/srv/tracker.debian.org/distro-tracker/distro_tracker/mail/dispatch.py", line 86, in process
    package, keyword = classify_message(msg, package, keyword)
  File "/srv/tracker.debian.org/distro-tracker/distro_tracker/mail/dispatch.py", line 189, in classify_message
    result, implemented = vendor.call('classify_message', msg,
  File "/srv/tracker.debian.org/distro-tracker/distro_tracker/vendor/common.py", line 76, in call
    return func(*args, **kwargs), True
  File "/srv/tracker.debian.org/distro-tracker/distro_tracker/vendor/debian/rules.py", line 137, in classify_message
    package, keyword = _classify_dak_message(msg, package, keyword)
  File "/srv/tracker.debian.org/distro-tracker/distro_tracker/vendor/debian/rules.py", line 88, in _classify_dak_message
    mail_news.create_news(msg, package, create_package=True)
  File "/srv/tracker.debian.org/distro-tracker/distro_tracker/mail/mail_news.py", line 43, in create_news
    return EmailNews.objects.create_email_news(message, package, **kwargs)
  File "/srv/tracker.debian.org/distro-tracker/distro_tracker/core/models.py", line 1716, in create_email_news
    create_kwargs = EmailNews.get_email_news_parameters(message)
  File "/srv/tracker.debian.org/distro-tracker/distro_tracker/core/models.py", line 1765, in get_email_news_parameters
    from_email = EmailNews.get_from_email(message)
  File "/srv/tracker.debian.org/distro-tracker/distro_tracker/core/models.py", line 1748, in get_from_email
    search_result = re.search(
  File "/usr/lib/python3.9/re.py", line 201, in search
    return _compile(pattern, flags).search(string)
TypeError: expected string or bytes-like object

It's not very hard to fix but I'm busy in the next 3 days so any help would be welcome.