* [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* Re: [PATCH b4] Fix broken fallback to user.email
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
1 sibling, 0 replies; 3+ messages in thread
From: Dave Marquardt @ 2025-07-18 13:14 UTC (permalink / raw)
To: Jonas Rebmann; +Cc: Kernel.org Tools, Konstantin Ryabitsev, kernel
Jonas Rebmann <jre@pengutronix.de> writes:
> 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'])
Reviewed-by: davemarq@linux.ibm.com
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH b4] Fix broken fallback to user.email
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
1 sibling, 0 replies; 3+ messages in thread
From: Konstantin Ryabitsev @ 2025-07-18 16:05 UTC (permalink / raw)
To: Kernel.org Tools, Jonas Rebmann; +Cc: kernel
On Fri, 18 Jul 2025 14:04:04 +0200, Jonas Rebmann wrote:
> 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.
>
> [...]
Applied, thanks!
[1/1] Fix broken fallback to user.email
commit: 5c822eded2b6f9df67f3e860a8a0017b440471da
Best regards,
--
Konstantin Ryabitsev <konstantin@linuxfoundation.org>
^ permalink raw reply [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.