Linux maintainer tooling and workflows
 help / color / mirror / Atom feed
From: Maxime Ripard <mripard@kernel.org>
To: tools@linux.kernel.org
Cc: Maxime Ripard <mripard@kernel.org>
Subject: [PATCH] b4: Fix envelopeSender handling
Date: Fri,  2 Jun 2023 17:25:54 +0200	[thread overview]
Message-ID: <20230602152554.2046764-1-mripard@kernel.org> (raw)

The manpage for git-send-email states that:

  Specify the envelope sender used to send the emails. This is useful if
  your default address is not the address that is subscribed to a list. In
  order to use the From address, set the value to "auto". If you use the
  sendmail binary, you must have suitable privileges for the -f parameter.
  Default is the value of the sendemail.envelopeSender configuration
  variable; if that is unspecified, choosing the envelope sender is left to
  your MTA.

However, b4 just reuses the value of sendemail.envelopeSender and passes it
down directly to the sendmail binary if relevant, which means that if we
were using the value "auto", we now have sendemail called with -f auto
instead of the proper mail address, confusing sendmail.

We can fix this by interpreting the auto value as suggested in the manpage.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 b4/__init__.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/b4/__init__.py b/b4/__init__.py
index 0197cf17ed33..9b1f69c9ff7b 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -3247,7 +3247,10 @@ def get_smtp(dryrun: bool = False) -> Tuple[Union[smtplib.SMTP, smtplib.SMTP_SSL
         # Do we have the envelopesender defined?
         env_sender = sconfig.get('envelopesender', '')
         if env_sender:
-            envpair = email.utils.parseaddr(env_sender)
+            if env_sender == "auto":
+                envpair = email.utils.parseaddr(fromaddr)
+            else:
+                envpair = email.utils.parseaddr(env_sender)
         else:
             envpair = email.utils.parseaddr(fromaddr)
         if envpair[1]:
-- 
2.40.1


             reply	other threads:[~2023-06-02 15:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-02 15:25 Maxime Ripard [this message]
2023-06-02 15:37 ` [PATCH] b4: Fix envelopeSender handling 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=20230602152554.2046764-1-mripard@kernel.org \
    --to=mripard@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 read-only IMAP folder(s) and NNTP newsgroup(s).