Skip to contentSkip to conversation

b4 send crashes when sendemail from is missing

DISCUSSION Neil Armstrong 2 participants 4 messages Sep 28, 2022 – Sep 29, 2022

lore
Share & tools
lore
#0 lore raw

Hi !

First, thanks for the b4 work !

I've finally tried the b4 prep/send feature and when doing the first send I got this crash:

$ b4 send --no-sign

Converted the branch to 7 patches

Populating To/Cc addresses

Will send the following messages:

---

To: <snip>

Cc <snip>

---

[PATCH v1 0/7] <snip>
---

Press Enter to send or Ctrl-C to abort

Connecting to smtp.gmail.com:587

---

[PATCH v1 0/7] <snip>
Traceback (most recent call last):

File "/home/narmstrong/bin/b4", line 8, in <module>

    sys.exit(cmd())

File "/home/narmstrong/.local/lib/python3.10/site-packages/b4/command.py", line 341, in cmd

cmdargs.func(cmdargs)

File "/home/narmstrong/.local/lib/python3.10/site-packages/b4/command.py", line 86, in cmd_send

    b4.ez.cmd_send(cmdargs)

File "/home/narmstrong/.local/lib/python3.10/site-packages/b4/ez.py", line 1259, in cmd_send

sent = b4.send_mail(smtp, send_msgs, fromaddr=fromaddr, destaddrs=alldests, patatt_sign=sign,

File "/home/narmstrong/.local/lib/python3.10/site-packages/b4/__init__.py", line 3210, in send_mail

smtp.sendmail(fromaddr, destaddrs, bdata)

File "/usr/lib/python3.10/smtplib.py", line 881, in sendmail

(code, resp) = self.mail(from_addr, esmtp_opts)

File "/usr/lib/python3.10/smtplib.py", line 545, in mail

    self.putcmd("mail", "FROM:%s%s" % (quoteaddr(sender), optionlist))

File "/usr/lib/python3.10/smtplib.py", line 154, in quoteaddr

    if addrstring.strip().startswith('<'):

AttributeError: 'NoneType' object has no attribute 'strip'

I figured the "from" field was missing from my gitconfig sendemail entry.

I checked and nowhere this "from" is required for git-send-email, perhaps get user.email or sendemail.smtpuser as fallback ?

Neil

Signature · 3 lines
Neil Armstrong <[email protected]>
Senior Software Engineer - Linaro Developer Services
https://linaro.org/services
#1 lore raw
Quoted 6 lines · Neil Armstrong

Hi !

First, thanks for the b4 work !
I've finally tried the b4 prep/send feature and when doing the first send I got this crash:

$ b4 send --no-sign

Or, you know, you can just sign things. ;)

Quoted 3 lines

I figured the "from" field was missing from my gitconfig sendemail entry.

I checked and nowhere this "from" is required for git-send-email, perhaps get user.email or sendemail.smtpuser as fallback ?

Yes, the latest master/stable-0.10.y will fall back to user.email if sendemail.from is not set. Thank you for the report.

-K

#2 lore raw
Quoted 9 lines · Konstantin Ryabitsev
Quoted 6 lines · Neil Armstrong

Hi !

First, thanks for the b4 work !
I've finally tried the b4 prep/send feature and when doing the first send I got this crash:

$ b4 send --no-sign

Or, you know, you can just sign things. ;)

It also crashed without a comprehensive error, I need to debug why!

Converted the branch to 7 patches

Populating To/Cc addresses

Will write out messages into <snip>

Traceback (most recent call last):

File "/home/narmstrong/bin/b4", line 8, in <module>

    sys.exit(cmd())

File "/home/narmstrong/.local/lib/python3.10/site-packages/b4/command.py", line 341, in cmd

cmdargs.func(cmdargs)

File "/home/narmstrong/.local/lib/python3.10/site-packages/b4/command.py", line 86, in cmd_send

    b4.ez.cmd_send(cmdargs)

File "/home/narmstrong/.local/lib/python3.10/site-packages/b4/ez.py", line 1259, in cmd_send

sent = b4.send_mail(smtp, send_msgs, fromaddr=fromaddr, destaddrs=alldests, patatt_sign=sign,

File "/home/narmstrong/.local/lib/python3.10/site-packages/b4/__init__.py", line 3145, in send_mail

    bdata = patatt.rfc2822_sign(bdata)

File "/home/narmstrong/.local/lib/python3.10/site-packages/patatt/__init__.py", line 1002, in rfc2822_sign

pm.sign(algo, keydata, identity=config.get('identity'), selector=config.get('selector'))

File "/home/narmstrong/.local/lib/python3.10/site-packages/patatt/__init__.py", line 569, in sign

hv, pkinfo = ds.sign(keyinfo)

File "/home/narmstrong/.local/lib/python3.10/site-packages/patatt/__init__.py", line 264, in sign

bval, pkinfo = DevsigHeader._sign_openpgp(digest, keyinfo)

File "/home/narmstrong/.local/lib/python3.10/site-packages/patatt/__init__.py", line 366, in _sign_openpgp

raise SigningError('Running gpg failed', errors=err.decode().split('\n'))

patatt.SigningError: Running gpg failed

Quoted 7 lines
Quoted 4 lines

I figured the "from" field was missing from my gitconfig sendemail entry.

I checked and nowhere this "from" is required for git-send-email, perhaps get user.email or sendemail.smtpuser as fallback ?

Yes, the latest master/stable-0.10.y will fall back to user.email if sendemail.from is not set. Thank you for the report.

Great, thanks !

Quoted 2 lines

-K

Neil

#3 lore raw
Quoted 4 lines · Neil Armstrong

File "/home/narmstrong/.local/lib/python3.10/site-packages/patatt/__init__.py", line 366, in _sign_openpgp
raise SigningError('Running gpg failed', errors=err.decode().split('\n'))

patatt.SigningError: Running gpg failed

Can you run:

    git format-patch -1 --stdout | patatt -d sign 2>/tmp/debug

/tmp/debug should contain the command it's trying to run to PGP-sign things, e.g. for me:

    Running gpg --batch --no-auto-key-retrieve --no-auto-check-trustdb -s -u B6C41CE35664996C!

That should help troubleshoot what's failing.

-K