All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH b4] Fix broken fallback to user.email
@ 2025-07-18 12:04 Jonas Rebmann
  2025-07-18 13:14 ` Dave Marquardt
  2025-07-18 16:05 ` Konstantin Ryabitsev
  0 siblings, 2 replies; 3+ messages in thread
From: Jonas Rebmann @ 2025-07-18 12:04 UTC (permalink / raw)
  To: Kernel.org Tools; +Cc: Konstantin Ryabitsev, kernel, Jonas Rebmann

After conversion to string, fromaddr becomes "None" as a string literal,
so the user.email fallback would never be reached if sendemail.from is
unset, eventually leading to `smtplib.SMTPSenderRefused` (<None>: sender
address must contain a domain').

Convert to string after the check.

Fixes: 742e017c1b ("Cleanup: initial round addressing typing issues reported by mypy")
Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
---
 src/b4/__init__.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/b4/__init__.py b/src/b4/__init__.py
index ff6075e..c116344 100644
--- a/src/b4/__init__.py
+++ b/src/b4/__init__.py
@@ -3949,8 +3949,10 @@ def get_sendemail_config() -> Dict[str, Optional[Union[str, List[str]]]]:
 def get_smtp(dryrun: bool = False) -> Tuple[Union[smtplib.SMTP, smtplib.SMTP_SSL, List[str], None], str]:
     sconfig = get_sendemail_config()
     # Limited support for smtp settings to begin with, but should cover the vast majority of cases
-    fromaddr = str(sconfig.get('from'))
-    if not fromaddr:
+    fromaddr = sconfig.get('from')
+    if fromaddr:
+        fromaddr = str(fromaddr)
+    else:
         # We fall back to user.email
         usercfg = get_user_config()
         fromaddr = str(usercfg['email'])

---
base-commit: a9b2aba54be85ea2933c43b8a6d71c1611230b59
change-id: 20250718-fromaddr-80e73bb6fd2d

Best regards,
--  
Jonas Rebmann <jre@pengutronix.de>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-18 16:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-18 12:04 [PATCH b4] Fix broken fallback to user.email Jonas Rebmann
2025-07-18 13:14 ` Dave Marquardt
2025-07-18 16:05 ` Konstantin Ryabitsev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.