Linux maintainer tooling and workflows
 help / color / mirror / Atom feed
* b4 send --output-dir eml's sent with git send-email creates two From: in the mail body
@ 2022-10-19 16:23 Quentin Schulz
  2022-10-19 19:32 ` Konstantin Ryabitsev
  0 siblings, 1 reply; 5+ messages in thread
From: Quentin Schulz @ 2022-10-19 16:23 UTC (permalink / raw)
  To: tools

Hi,

I recently encountered some issue with my particular setup.

https://lore.kernel.org/lkml/20221019-upstream-puma-sd-40mhz-v1-0-754a76421518@theobroma-systems.com/raw 
is the problematic mail, note the two From: lines in the mail body.

This particular patch has a git author (Jakob) different from my local 
git identity (Quentin Schulz <quentin.schulz at theobroma-systems.com>) 
which is different from the sendemail.from configuration (Quentin Schulz 
<foss+kernel at 0leil.net>).

The eml file created by b4 send --output-dir has the From: field using 
the current git identity which I assume is the issue. If I then send the 
mail with git-send-email tool, I get two From: lines in the body, which 
is not ok for git am (since it'll take the first one, which is incorrect).

I tried the following diff:
```
diff --git a/b4/__init__.py b/b4/__init__.py
index fe03834..b8e057e 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -3210,6 +3210,8 @@ def send_mail(smtp: Union[smtplib.SMTP, 
smtplib.SMTP_SSL, None], msgs: Sequence[
      for msg in msgs:
          if not msg.get('X-Mailer'):
              msg.add_header('X-Mailer', f'b4 {__VERSION__}')
+        if fromaddr:
+            msg.replace_header('From', fromaddr)
          msg.set_charset('utf-8')
          msg.replace_header('Content-Transfer-Encoding', '8bit')
          msg.policy = email.policy.EmailPolicy(utf8=True, cte_type='8bit')
```

but this then messes up the patches where I'm the author, because the 
From: line will not appear in the body and the author will thus be 
incorrect once again.

Any hint on how to fix this properly? It could also be a git 
configuration issue on my end, not ruling anything out :)

Thanks!
Quentin

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

end of thread, other threads:[~2022-10-31 21:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-19 16:23 b4 send --output-dir eml's sent with git send-email creates two From: in the mail body Quentin Schulz
2022-10-19 19:32 ` Konstantin Ryabitsev
2022-10-20  9:03   ` Quentin Schulz
2022-10-21 19:57   ` Bjorn Helgaas
2022-10-31 21:09     ` Konstantin Ryabitsev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox