Linux maintainer tooling and workflows
 help / color / Atom feed
* b4 ty unicode crash
@ 2020-12-28 16:13 Mark Brown
  2020-12-28 16:56 ` Konstantin Ryabitsev
  2020-12-28 18:18 ` Konstantin Ryabitsev
  0 siblings, 2 replies; 4+ messages in thread
From: Mark Brown @ 2020-12-28 16:13 UTC (permalink / raw)
  To: tools, konstantin


[-- Attachment #1: Type: text/plain, Size: 1480 bytes --]

Hi,

When I run b4 ty and it finds what looks like:

   https://lore.kernel.org/r/ec66399502514edbb1de3cf9bff08b1d@realtek.com

I get a traceback:

Generating 4 thank-you letters
Traceback (most recent call last):
  File "/home/broonie/git/b4/b4/command.py", line 236, in <module>
    cmd()
  File "/home/broonie/git/b4/b4/command.py", line 219, in cmd
    cmdargs.func(cmdargs)
  File "/home/broonie/git/b4/b4/command.py", line 61, in cmd_ty
    b4.ty.main(cmdargs)
  File "/home/broonie/git/b4/b4/ty.py", line 638, in main
    auto_thankanator(cmdargs)
  File "/home/broonie/git/b4/b4/ty.py", line 392, in auto_thankanator
    send_messages(applied, cmdargs.gitdir, cmdargs.outdir, wantbranch, since=cmdargs.since)
  File "/home/broonie/git/b4/b4/ty.py", line 429, in send_messages
    msg = generate_am_thanks(gitdir, jsondata, branch, since)
  File "/home/broonie/git/b4/b4/ty.py", line 351, in generate_am_thanks
    msg = make_reply(thanks_template, jsondata)
  File "/home/broonie/git/b4/b4/ty.py", line 96, in make_reply
    msg['Cc'] = b4.format_addrs(allcc)
  File "/home/broonie/git/b4/b4/__init__.py", line 2382, in format_addrs
    addrs.add(email.utils.formataddr((LoreMessage.clean_header(pair[0]), LoreMessage.clean_header(pair[1]))))
  File "/usr/lib/python3.7/email/utils.py", line 91, in formataddr
    address.encode('ascii')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 22-24: ordinal not in range(128)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 499 bytes --]

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

* Re: b4 ty unicode crash
  2020-12-28 16:13 b4 ty unicode crash Mark Brown
@ 2020-12-28 16:56 ` Konstantin Ryabitsev
  2020-12-28 18:18 ` Konstantin Ryabitsev
  1 sibling, 0 replies; 4+ messages in thread
From: Konstantin Ryabitsev @ 2020-12-28 16:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: tools


[-- Attachment #1: Type: text/plain, Size: 957 bytes --]

On Mon, Dec 28, 2020 at 04:13:47PM +0000, Mark Brown wrote:
> Hi,
> 
> When I run b4 ty and it finds what looks like:
> 
>    https://lore.kernel.org/r/ec66399502514edbb1de3cf9bff08b1d@realtek.com
> 
> I get a traceback:

Urgh, this uncovered a bug in Python:

In [5]: from email import utils

In [6]: utils.getaddresses(['foo <foo@bar.com>'])
Out[6]: [('foo', 'foo@bar.com')]

In [7]: utils.getaddresses(['Shuming [范書銘] <shumingf@realtek.com>'])
Out[7]:
[('', 'Shuming'),
 ('', ''),
 ('', '范書銘'),
 ('', ''),
 ('', 'shumingf@realtek.com')]

It crashes when it tries to treat "范書銘" as an email address.

>   File "/usr/lib/python3.7/email/utils.py", line 91, in formataddr
>     address.encode('ascii')
> UnicodeEncodeError: 'ascii' codec can't encode characters in position 22-24: ordinal not in range(128)

I'm not sure how to tackle this yet, but I'll try to figure it out.

Thanks for the report.

-K

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 235 bytes --]

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

* Re: b4 ty unicode crash
  2020-12-28 16:13 b4 ty unicode crash Mark Brown
  2020-12-28 16:56 ` Konstantin Ryabitsev
@ 2020-12-28 18:18 ` Konstantin Ryabitsev
  2020-12-29 12:16   ` [tools] " Mark Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Konstantin Ryabitsev @ 2020-12-28 18:18 UTC (permalink / raw)
  To: Mark Brown; +Cc: tools


[-- Attachment #1: Type: text/plain, Size: 543 bytes --]

On Mon, Dec 28, 2020 at 04:13:47PM +0000, Mark Brown wrote:
> Hi,
> 
> When I run b4 ty and it finds what looks like:
> 
>    https://lore.kernel.org/r/ec66399502514edbb1de3cf9bff08b1d@realtek.com
> 
> I get a traceback:

I have an attempted fix for this in master/stable-0.6.y, but it will only
apply to future series you fetch with "b4 am", not any existing tracking files
in ~/.local/share/b4. It's not a perfect fix, since the underlying Python bug
is still there, but the changes should avoid hitting it in most cases.

-K

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 235 bytes --]

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

* Re: [tools] b4 ty unicode crash
  2020-12-28 18:18 ` Konstantin Ryabitsev
@ 2020-12-29 12:16   ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2020-12-29 12:16 UTC (permalink / raw)
  To: tools, konstantin


[-- Attachment #1: Type: text/plain, Size: 448 bytes --]

On Mon, Dec 28, 2020 at 01:18:30PM -0500, Konstantin Ryabitsev wrote:

> I have an attempted fix for this in master/stable-0.6.y, but it will only
> apply to future series you fetch with "b4 am", not any existing tracking files
> in ~/.local/share/b4. It's not a perfect fix, since the underlying Python bug
> is still there, but the changes should avoid hitting it in most cases.

Great, thanks!  I'll let you know if I run into anything.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 499 bytes --]

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-28 16:13 b4 ty unicode crash Mark Brown
2020-12-28 16:56 ` Konstantin Ryabitsev
2020-12-28 18:18 ` Konstantin Ryabitsev
2020-12-29 12:16   ` [tools] " Mark Brown

Linux maintainer tooling and workflows

Archives are clonable:
	git clone --mirror https://lore.kernel.org/tools/0 tools/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 tools tools/ https://lore.kernel.org/tools \
		tools@linux.kernel.org
	public-inbox-index tools

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.linux.tools


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git