Jeremy White : Protect against patches that break the parsing.

Alexandre Julliard julliard at winehq.org
Thu Jun 23 22:24:05 CDT 2022


Module: tools
Branch: master
Commit: af62ee218ed25a1502490a1017cf53d23cf65307
URL:    https://source.winehq.org/git/tools.git/?a=commit;h=af62ee218ed25a1502490a1017cf53d23cf65307

Author: Jeremy White <jwhite at codeweavers.com>
Date:   Thu Jun 23 22:20:01 2022 -0500

Protect against patches that break the parsing.

A patch that starts with '^From ' in the body
breaks our parsing.

See for example:
https://gitlab.winehq.org/wine/wine/-/merge_requests/307/diffs?commit_id=5fade981ad38ba454191e201ef98f1028b375cfa

This change doesn't make it work perfectly, but keeps
us from failing, and spamming the mailing list.

---

 gitlab/gitlab-to-mail/gitlabtomail.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gitlab/gitlab-to-mail/gitlabtomail.py b/gitlab/gitlab-to-mail/gitlabtomail.py
index e113eaae..8333588e 100755
--- a/gitlab/gitlab-to-mail/gitlabtomail.py
+++ b/gitlab/gitlab-to-mail/gitlabtomail.py
@@ -628,6 +628,10 @@ def process_mr(mr, update_db):
         for nr, mail in enumerate(patches):
             # The hope is that a slight delay will allow receivers to order the patches correctly.
             time.sleep(0.1)
+            if mail['From'] == None:
+                log(f"Error: MR {iid} patch {nr} has no From")
+                continue
+
             fixup_patch(mail, iid, version, nr+1)
             date = date + datetime.timedelta(seconds=1)
             fixup_date(mail, date)




More information about the wine-cvs mailing list