From fd7a85e360f7e5f4f4277246f5b40ced2a7f0aaa Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Thu, 19 Nov 2026 10:33:31 +0100 Subject: [PATCH] mailbot: ignore empty entries in config lists With an empty 'awaiting-upstream=' option, the list contained an empty string, and '' is found in any subject tags: every new patch series was then marked as 'Awaiting Upstream'. Parse the 'authorized', 'error-bots' and 'awaiting-upstream' lists with a helper that drops empty entries and strips spaces. These options are now also optional, which is useful for instances that don't need them. Signed-off-by: Matthieu Baerts --- mailbot.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/mailbot.py b/mailbot.py index 7192b9c8..0eaf97a4 100755 --- a/mailbot.py +++ b/mailbot.py @@ -694,6 +694,12 @@ def check_new(tree, pw, dr): do_mail_file(os.path.join(tree.path, 'm'), pw, dr) +def config_list(section, option): + """ Comma-separated list, ignoring empty entries """ + val = config.get(section, option, fallback='') + return {x.strip() for x in val.split(',') if x.strip()} + + def main(): # Init state global config @@ -715,14 +721,9 @@ def main(): if ua: http_headers = {"user-agent":ua} - users = config.get('mailbot', 'authorized') - authorized_users.update(set(users.split(','))) - - users = config.get('mailbot', 'error-bots') - auto_changes_requested.update(set(users.split(','))) - - users = config.get('mailbot', 'awaiting-upstream') - auto_awaiting_upstream.update(set(users.split(','))) + authorized_users.update(config_list('mailbot', 'authorized')) + auto_changes_requested.update(config_list('mailbot', 'error-bots')) + auto_awaiting_upstream.update(config_list('mailbot', 'awaiting-upstream')) tree_dir = config.get('dirs', 'trees', fallback=os.path.join(NIPA_DIR, "../")) mail_repos = {}