Message ID | 9bdb42f7-661a-77ed-97e5-33ba7a31fd9e@theobroma-systems.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | b4 send --output-dir eml's sent with git send-email creates two From: in the mail body | expand |
On Wed, Oct 19, 2022 at 06:23:09PM +0200, Quentin Schulz wrote: > 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>). I'm going to point fingers at git-send-email here, because it shouldn't stick another From: into the body when it already sees a From: there. You should report this to git maintainers as a bug. That said... > The eml file created by b4 send --output-dir has the From: field using the > current git identity which I assume is the issue. Right, we're not doing quite the right thing here either, because when there's a sendemail.from set up, we should be using that instead of the user.name + user.email. I'll see how we can fix this up to do the right thing. Thank you for the report. -K
Hi Konstantin, On 10/19/22 21:32, Konstantin Ryabitsev wrote: > On Wed, Oct 19, 2022 at 06:23:09PM +0200, Quentin Schulz wrote: >> Hi, >> >> I recently encountered some issue with my particular setup. >> >> https://urldefense.proofpoint.com/v2/url?u=https-3A__lore.kernel.org_lkml_20221019-2Dupstream-2Dpuma-2Dsd-2D40mhz-2Dv1-2D0-2D754a76421518-40theobroma-2Dsystems.com_raw&d=DwIBaQ&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=3N_s7FaOdYHdJMby-XVFQf58qtINncJFtBc_oRqX8C4u5PcoifqemzDuWAyza5ef&s=9tuNrkRYhAXplODVZKdP3zXXV8R8IDPhP5XNItUrsrM&e= >> 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>). > > I'm going to point fingers at git-send-email here, because it shouldn't stick > another From: into the body when it already sees a From: there. You should > report this to git maintainers as a bug. > https://lore.kernel.org/git/09e125ea-5ea5-40c8-575e-57cb7e1806ff@theobroma-systems.com/ is the bug report to git community if anyone wants to follow the discussion there. > That said... > >> The eml file created by b4 send --output-dir has the From: field using the >> current git identity which I assume is the issue. > > Right, we're not doing quite the right thing here either, because when there's > a sendemail.from set up, we should be using that instead of the user.name + > user.email. I'll see how we can fix this up to do the right thing. > Lemme know if there's anything I can help with or test. > Thank you for the report. > Thanks for the tool, it's been something I've been wanting to have for a while already (not a maintainer, but the shazam+prep combo is awesome and I'm very much looking forward to the --compare-to feature that was recently added). Cheers, Quentin
On Wed, Oct 19, 2022 at 03:32:08PM -0400, Konstantin Ryabitsev wrote: > On Wed, Oct 19, 2022 at 06:23:09PM +0200, Quentin Schulz wrote: > ... > That said... > > > The eml file created by b4 send --output-dir has the From: field using the > > current git identity which I assume is the issue. > > Right, we're not doing quite the right thing here either, because when there's > a sendemail.from set up, we should be using that instead of the user.name + > user.email. I'll see how we can fix this up to do the right thing. I think I'm seeing a similar issue. I have: [user] name = Bjorn Helgaas email = bhelgaas@google.com [sendemail] from = Bjorn Helgaas <helgaas@kernel.org> and when I send patches with "git send-email", it works fine, e.g., https://lore.kernel.org/all/20221014001911.3342485-1-helgaas@kernel.org/ But if I send patches with "b4 send" (0.10.1), the email is sent with "From: Bjorn Helgaas <bhelgaas@google.com>", e.g., https://lore.kernel.org/all/20221021-wip-bjorn-22-10-slow-down-io-alpha-v2-0-4f89a85f1b61@google.com/ which seems to make it to the vger lists, but I get DMARC bounces for other folks. Bjorn
On Fri, Oct 21, 2022 at 02:57:27PM -0500, Bjorn Helgaas wrote: > > > The eml file created by b4 send --output-dir has the From: field using the > > > current git identity which I assume is the issue. > > > > Right, we're not doing quite the right thing here either, because when there's > > a sendemail.from set up, we should be using that instead of the user.name + > > user.email. I'll see how we can fix this up to do the right thing. > > I think I'm seeing a similar issue. I have: > > [user] > name = Bjorn Helgaas > email = bhelgaas@google.com > > [sendemail] > from = Bjorn Helgaas <helgaas@kernel.org> I have a fix in master and stable-0.10.y that should do the right thing when sendemail.from is set. I still need to write tests for it, but it appears to be doing the right thing. Best regards, Konstantin
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')
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: ``` 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