All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Marquardt <davemarq@linux.ibm.com>
To: Jonas Rebmann <jre@pengutronix.de>
Cc: "Kernel.org Tools" <tools@kernel.org>,
	Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
	kernel@pengutronix.de
Subject: Re: [PATCH b4] Fix broken fallback to user.email
Date: Fri, 18 Jul 2025 08:14:43 -0500	[thread overview]
Message-ID: <87seittzcs.fsf@linux.ibm.com> (raw)
In-Reply-To: <20250718-fromaddr-v1-1-8bc274dce855@pengutronix.de> (Jonas Rebmann's message of "Fri, 18 Jul 2025 14:04:04 +0200")

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

  reply	other threads:[~2025-07-18 13:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-18 12:04 [PATCH b4] Fix broken fallback to user.email Jonas Rebmann
2025-07-18 13:14 ` Dave Marquardt [this message]
2025-07-18 16:05 ` Konstantin Ryabitsev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87seittzcs.fsf@linux.ibm.com \
    --to=davemarq@linux.ibm.com \
    --cc=jre@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --cc=konstantin@linuxfoundation.org \
    --cc=tools@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.