patchwork/bin/parsemail: Make "[PATCH" prefix mandatory
PATCH 1/1 patchwork/bin/parsemail: Make "[PATCH" prefix mandatory
Patchwork may incorrectly identify emails containing patch-like content as patches.
This change makes "[PATCH" prefix in subject mandatory for emails to be considered as new patches.
[YOCTO #10764]
--- patchwork/bin/parsemail.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
patchwork/bin/parsemail.py +2 -1
@@ -399,7 +399,8 @@ def find_content(project, mail): refs = build_references_list(mail) is_root = refs == [] is_cover_letter = is_root and x == 0 - is_patch = patchbuf is not None + patch_prefix = re.search('\[\s*PATCH', mail.get('Subject')) + is_patch = patchbuf is not None and patch_prefix drop_patch = not is_attachment and \ project.git_send_email_only and not is_git_send_email(mail)
Signature · 1 line
1.9.1
Quoted 17 lines · Jose Lamego
Patchwork may incorrectly identify emails containing patch-like content as patches.
This change makes "[PATCH" prefix in subject mandatory for emails to be considered as new patches.[YOCTO #10764]
Signed-off-by Jose Lamego <[email protected]>--- patchwork/bin/parsemail.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)patchwork/bin/parsemail.py +0
-0
patchwork/bin/parsemail.py def find_content(project, mail): · line 403
Quoted 6 lines
patchwork/bin/parsemail.py +2
-1@@ -399,7 +399,8 @@ def find_content(project, mail): refs = build_references_list(mail) is_root = refs == [] is_cover_letter = is_root and x == 0 - is_patch = patchbuf is not None + patch_prefix = re.search('\[\s*PATCH', mail.get('Subject')) + is_patch = patchbuf is not None and patch_prefix
This is indeed enough to weed out diffs that were inlined in normal discussions (example from YOCTO #10764).
But we also have other examples and another bug (YOCTO #10877) where a reply to a patch caused patchwork to create a new entry:
Subject: Re: [OE-core] [PATCH v2 1/2] grub_git: extend recipe for proper target deployment
...
Ping!
I'm wondering if we can address two bugs with the same fix, something that requires that the Subject line is starting with a set of tags plus the [PATCH] tag. For example:
patch_prefix = re.match('(\s*\[[^]]*\]\s*)*\[\s*PATCH', mail.get('Subject'))
Signature · 6 lines
Best Regards, Patrick Ohly The content of this message is my personal opinion only and although I am an employee of Intel, the statements I make here in no way represent Intel's position on the issue, nor am I authorized to speak on behalf of Intel on this matter.
Quoted 8 lines · Patrick Ohly
...
I'm wondering if we can address two bugs with the same fix, something that requires that the Subject line is starting with a set of tags plus the [PATCH] tag. For example:
patch_prefix=re.match('(\s*\[[^]]*\]\s*)*\[\s*PATCH', mail.get('Subject'))
Based on Patrick's suggestion, v2 of this patch would require for any new email message to be handled as a likely new patch (message content still needs to be parsed as usual):
- Message subject MUST start only with any of the accepted OE layer's
prefixes; in other words, subject must start with square bracket "[" plus prefix (maybe only the bracket will be enough).
and
- Message subject MUST contain the "[PATCH" prefix.
messages with a subject that starts with any other character (including "Re: " and "Fwd: " or that do not include the "[PATCH" prefix will be handled either as a comment to an existing patch or as an ordinary mailing list post, depending on the included email references and content parsing.
I see no conflicts with steps on the wiki "How to submit a patch to OpenEmbedded":
http://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded
Please provide feedback on this approach before I implement a test in the staging instance.
Signature · 1 line
Jose Lamego | OTC Embedded Platforms & Tools | GDC
PATCH 1/1 patchwork/bin/parsemail: Improve new patch filtering
From: Jose Lamego <[email protected]>
Patchwork may incorrectly identify emails containing patch-like content or that are replies/forwards from a previous message as patches, thus wrongly creating a new series revision.
This change makes "[PATCH" prefix in subject mandatory for emails to be considered as possible new patches, and makes any email with a subject starting with any character other than a square bracket ("[") to be handled as a possible comment to an existing patch.
[YOCTO #10764]
[YOCTO #10877]
---
Notes:
v2 renamed to reflect that the subject filtering now includes ruling-out emails with a Subject header not starting with the expected square bracket
patchwork/bin/parsemail.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
patchwork/bin/parsemail.py +2 -1
@@ -399,7 +399,8 @@ def find_content(project, mail): refs = build_references_list(mail) is_root = refs == [] is_cover_letter = is_root and x == 0 - is_patch = patchbuf is not None + patch_prefix = re.match('(\s*\[[^]]*\]\s*)*\[\s*PATCH', mail.get('Subject')) + is_patch = patchbuf is not None and patch_prefix drop_patch = not is_attachment and \ project.git_send_email_only and not is_git_send_email(mail)
Signature · 1 line
1.9.1