aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-08-03 11:19:48 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-08-03 11:23:22 -0400
commitfb9c3b878d22f6e52285ebbb2c667b979bf13069 (patch)
treea564b7c75953506a5409f980289d76bb9b03d3dd
parentd0e8fa3bb2475187fbf9fcfe73c38ec83ad7e6b5 (diff)
downloadb4-fb9c3b878d22f6e52285ebbb2c667b979bf13069.tar.gz
Don't consider signature contents for trailers
Drop anything in the body below "-- " before parsing the contents for trailers. This won't catch all possible situations, as the "-- " standard is a bit of a dying standard, so add a list of known baddies like "Phone:" and "Email:" that are likely to trip us up. Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/tools/20210719213535.vw3u4yg5mgxqysaf@pengutronix.de/ Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/__init__.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/b4/__init__.py b/b4/__init__.py
index 0e007be..35be4a9 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -1252,8 +1252,11 @@ class LoreMessage:
@staticmethod
def find_trailers(body, followup=False):
- headers = ('subject', 'date', 'from')
- nonperson = ('fixes', 'subject', 'date', 'link', 'buglink', 'obsoleted-by')
+ ignores = {'phone', 'email'}
+ headers = {'subject', 'date', 'from'}
+ nonperson = {'fixes', 'subject', 'date', 'link', 'buglink', 'obsoleted-by'}
+ # Ignore everything below standard email signature marker
+ body = body.split('\n-- \n', 1)[0].strip() + '\n'
# Fix some more common copypasta trailer wrapping
# Fixes: abcd0123 (foo bar
# baz quux)
@@ -1276,6 +1279,9 @@ class LoreMessage:
groups = list(matches.groups())
# We only accept headers if we haven't seen any non-trailer lines
tname = groups[0].lower()
+ if tname in ignores:
+ logger.debug('Ignoring known non-trailer: %s', line)
+ continue
if len(others) and tname in headers:
logger.debug('Ignoring %s (header after other content)', line)
continue