git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Marvin Häuser" <mhaeuser@posteo.de>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [BUG] send-email propagates "In-Reply-To"
Date: Mon, 23 Aug 2021 17:44:32 +0000 (UTC)	[thread overview]
Message-ID: <5cd5a58b-ac9e-4628-a8d3-836b1f795732@posteo.de> (raw)
In-Reply-To: <YSPOOGxTMEgStdjJ@coredump.intra.peff.net>


23.08.2021 18:35:14 Jeff King <peff@peff.net>:

> On Sun, Aug 22, 2021 at 09:24:12AM +0000, Marvin Häuser wrote:
>
>> "git send-email" propagates the "In-Reply-To" header of the last prior patch
>> with such defined to subsequent patches which do not define such explicitly.
>> I suspect this behaviour is incorrect as I could not find any documentation
>> on this. I'm sorry if this behaviour is actually expected, and would be
>> happy if someone could point me to the appropriate documentation. This was
>> reproduced on Fedora 34 with git 2.33.0 and "--no-thread".
>>
>> Steps to reproduce:
>> 1. Create two patches, one of which has an "In-Reply-To" field
>> ("patch-in-reply.patch") and one of which does not
>> ("patch-no-in-reply.patch").
>> 2. Run "git send-email --dry-run --no-thread patch-in-reply.patch
>> patch-no-in-reply.patch"
>> 2.1. Observe the emission of an "In-Reply-To" header for
>> "patch-no-in-reply.patch" with no such header.
>> 3. Run "git send-email --dry-run --no-thread patch-no-in-reply.patch
>> patch-in-reply.patch"
>> 3.1. Observe the omission of an "In-Reply-To" header for
>> "patch-no-in-reply.patch" with no such header.
>>
>> Expected behaviour:
>> With no threading and no other sorts of explicitly defining the
>> "In-Reply-To" header, I expect to always observe the behaviour of 3.1., and
>> to not observe the behaviour of 2.1.
>
> Yes, I think this is just a bug. If the user requested --no-thread, then
> we should be sending each patch as it appears on disk, with no
> modification to the in-reply-to header.

OK, thank you.

>
>> The "issue" is "in_reply_to" is overwritten here [1], which is the main loop
>> worker to process all files passed to send-email [2], but it is not restored
>> for subsequent patches. Unless required otherwise (e.g. send-email
>> threading), it should be restored to its default value for each patch I
>> believe.
>
> Right. Most of the values we parse are declared inside the process_file
> function, and so start empty. $in_reply_to is special in that we need to
> carry its value across multiple files, so we need to always handle it in
> each loop iteration, whether we are setting it to a new value or
> resetting it to null.
>
>> I wrote a quick patch to adjust 2.1. to 3.1. [3]. I have no time right now
>> to review the submission guidelines (and thus did not submit the patch
>> "properly" yet), but I will try to get to that tonight or some time next
>> week. If in the mean time you could provide any feedback on the behaviour or
>> the patch, so that I can get things right the first time, that would be
>> great!
>
> Your patch looks like the right direction. Handling $references at the
> same time is the right thing to do. The extra setting of $subject seems
> weird, though.

Basically the idea is to either 1) advance the values (for threading) or 2) reset them to their defaults, i.e. never just preserve them. I neither know Perl nor the git design well, so I just applied the pattern to the subject as well. Should I just drop it? What would be the potential issues with enforcing the pattern?

>
> We'd want to add a test to t/t9001-send-email.sh, too, I'd think.

I'm not home and I might need a few days to look into this. Any helping hand is greatly appreciated. :)

Thanks!

Best regards,
Marvin

>
> -Peff


  reply	other threads:[~2021-08-23 17:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-22  9:24 [BUG] send-email propagates "In-Reply-To" Marvin Häuser
2021-08-22 12:11 ` Bagas Sanjaya
2021-08-23 16:35 ` Jeff King
2021-08-23 17:44   ` Marvin Häuser [this message]
2021-08-23 18:27     ` Jeff King
2021-08-23 21:47       ` Marvin Häuser
2021-08-24  7:48         ` Carlo Marcelo Arenas Belón
2021-08-25  0:15         ` Jeff King

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5cd5a58b-ac9e-4628-a8d3-836b1f795732@posteo.de \
    --to=mhaeuser@posteo.de \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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).