diff mbox series

b4: Fix envelopeSender handling

Message ID 20230602152554.2046764-1-mripard@kernel.org (mailing list archive)
State Accepted
Headers show
Series b4: Fix envelopeSender handling | expand

Commit Message

mripard@kernel.org June 2, 2023, 3:25 p.m. UTC
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(-)

Comments

Konstantin Ryabitsev June 2, 2023, 3:37 p.m. UTC | #1
On Fri, 02 Jun 2023 17:25:54 +0200, Maxime Ripard wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/1] b4: Fix envelopeSender handling
      commit: c6835b7538331fc84b3743f57812181acd71dab6

Best regards,
diff mbox series

Patch

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]: