tools.linux.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
To: Mark Brown <broonie@kernel.org>
Cc: tools@linux.kernel.org
Subject: Re: Crash generating a thanks
Date: Mon, 1 Nov 2021 12:00:32 -0400	[thread overview]
Message-ID: <20211101160032.gz46kfybjruvgb4k@meerkat.local> (raw)
In-Reply-To: <YXxhlEuodVLx8KjI@sirena.org.uk>

On Fri, Oct 29, 2021 at 10:03:16PM +0100, Mark Brown wrote:
> Hi,
> 
> Attempting to generate a thanks with current tip:
> 
> 750286a7aba7dc091b4407c9f31157129aade588 ty: fix bugs introduced when switching -s to -t
> 
> I get a traceback on one particular patch:
> 
> Sending: Re: [PATCH] sound: soc: tlv320aic3x: Make aic3x_remove() return void
> Traceback (most recent call last):
>   File "/home/broonie/git/b4/b4/command.py", line 287, in <module>
>     cmd()
>   File "/home/broonie/git/b4/b4/command.py", line 270, in cmd
>     cmdargs.func(cmdargs)
>   File "/home/broonie/git/b4/b4/command.py", line 96, in cmd_ty
>     b4.ty.main(cmdargs)
>   File "/home/broonie/git/b4/b4/ty.py", line 661, in main
>     auto_thankanator(cmdargs)
>   File "/home/broonie/git/b4/b4/ty.py", line 377, in auto_thankanator
>     send_messages(applied, wantbranch, cmdargs)
>   File "/home/broonie/git/b4/b4/ty.py", line 443, in send_messages
>     smtp.sendmail(fromaddr, sendto, msg.as_string(policy=mypolicy))  # noqa
>   File "/usr/lib/python3.9/smtplib.py", line 859, in sendmail
>     msg = _fix_eols(msg).encode('ascii')
> UnicodeEncodeError: 'ascii' codec can't encode character '\xf6' in position 55: ordinal not in range(128)

Thanks for the report. I think either I misunderstand the SMTP RFCs, or the
writers of Python's smtplib don't properly understand the difference between
the 8BITMIME and SMTPUTF8 capabilities. If the server reports 8BITMIME support
(and they all do, it's not the 90s any more), then anything following DATA
can contain 8bit content -- whether it's in the headers or the body of the
message.

Only when the email addresses themselves contain non-ascii characters AND when
they are used as either part of MAIL FROM or RCPT TO do we have to worry about
SMTPUTF8.

E.g. this doesn't require SMTPUTF8:

    MAIL FROM: <me@example.org>
    RCPT TO: <you@example.org>
    DATA
    From: Mé <me@example.org>
    To: Yôu <you@example.org>

    Hello world.
    .

Only this does:

    MAIL FROM: <mé@example.org>
    RCPT TO: <yôu@example.org>
    DATA
    From: Mé <mé@example.org>
    To: Yôu <yôu@example.org>

    Hello world.
    .

And yet, in certain situations smtplib seems to want to force-convert
everything to ascii even when you specifically tell it to not do that. It's
entirely possible that they are right and I'm wrong here, but my hands-on
testing with a couple of SMTP servers thus far haven't disabused me of this
understanding of the RFC and what 8BITMIME means.

Anyway, I think I have the fix in master that doesn't trigger this problem.
Please try it out and let me know if you see any more problems.

-K

  reply	other threads:[~2021-11-01 16:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-29 21:03 Crash generating a thanks Mark Brown
2021-11-01 16:00 ` Konstantin Ryabitsev [this message]
2021-11-02 18:31   ` Mark Brown

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=20211101160032.gz46kfybjruvgb4k@meerkat.local \
    --to=konstantin@linuxfoundation.org \
    --cc=broonie@kernel.org \
    --cc=tools@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).