Git development
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Harald Nordgren via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Harald Nordgren <haraldnordgren@gmail.com>
Subject: Re: [PATCH v5 2/4] imap-send: accept messages with Subject before Date
Date: Mon, 16 Nov 2026 08:44:07 +0100	[thread overview]
Message-ID: <avq0R5zx0PgSN-Oa@pks.im> (raw)
In-Reply-To: <fa90c64a5cab1964988a84b61f4b7af0d9e8b4ad.1793521297.git.gitgitgadget@gmail.com>

On Sun, Nov 01, 2026 at 08:21:35AM +0000, Harald Nordgren via GitGitGadget wrote:
> diff --git a/imap-send.c b/imap-send.c
> index 7e74c37a72..391bd8b96a 100644
> --- a/imap-send.c
> +++ b/imap-send.c
> @@ -1457,6 +1457,22 @@ static void wrap_in_html(struct strbuf *msg)
>  	*msg = buf;
>  }
>  
> +static bool has_required_headers(const char *line)
> +{
> +	bool from = false, date = false, subject = false;
> +
> +	while ((line = strchr(line, '\n')) &&
> +	       *++line != '\n' && !starts_with(line, "\r\n")) {

Okay, this now detects "\r\n" and "\n". But I think that the behaviour
here is quite subtle with how we increment `*++line` and how that
impacts the subsequent `starts_with()`.

Would this be easier to understand if we had something like this:

	while ((line = strchr(line, '\n')) &&
	       !starts_with(line, "\n\n") &&
	       !starts_with(line, "\n\r\n")) {
		line++;
		...
	}

Other than that I'm happy with this version, thanks!

Patrick

  reply	other threads:[~2026-11-16  7:44 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 19:19 [PATCH 0/2] Fix imap-send with reordered message headers Harald Nordgren via GitGitGadget
2026-10-19 19:19 ` [PATCH 1/2] imap-send: avoid leaking the tunnel command Harald Nordgren via GitGitGadget
2026-10-19 19:19 ` [PATCH 2/2] imap-send: accept messages with Subject before Date Harald Nordgren via GitGitGadget
2026-10-19 22:00   ` Junio C Hamano
2026-10-20  7:28     ` Harald Nordgren
2026-10-21  7:07 ` [PATCH v2 0/2] Fix imap-send with reordered message headers Harald Nordgren via GitGitGadget
2026-10-21  7:07   ` [PATCH v2 1/2] imap-send: avoid leaking the tunnel command Harald Nordgren via GitGitGadget
2026-10-21  8:24     ` Patrick Steinhardt
2026-10-21  8:53       ` Harald Nordgren
2026-10-21  7:07   ` [PATCH v2 2/2] imap-send: accept messages with Subject before Date Harald Nordgren via GitGitGadget
2026-10-21  8:25     ` Patrick Steinhardt
2026-10-21  8:45       ` Harald Nordgren
2026-10-21  9:36         ` Patrick Steinhardt
2026-10-21  9:59           ` Harald Nordgren
2026-10-22  6:56 ` [PATCH v3 0/4] Fix imap-send with reordered message headers Harald Nordgren via GitGitGadget
2026-10-22  6:56   ` [PATCH v3 1/4] imap-send: wait for the tunnel command to finish Harald Nordgren via GitGitGadget
2026-10-26  9:42     ` Patrick Steinhardt
2026-10-26  9:59       ` Harald Nordgren
2026-10-22  6:56   ` [PATCH v3 2/4] imap-send: accept messages with Subject before Date Harald Nordgren via GitGitGadget
2026-10-22  6:56   ` [PATCH v3 3/4] imap-send: check git send-email copies like other messages Harald Nordgren via GitGitGadget
2026-10-26  9:42     ` Patrick Steinhardt
2026-10-26 10:02       ` Harald Nordgren
2026-10-22  6:56   ` [PATCH v3 4/4] imap-send: match header names case insensitively Harald Nordgren via GitGitGadget
2026-10-26  9:42     ` Patrick Steinhardt
2026-10-27  8:31 ` [PATCH v4 0/4] Fix imap-send with reordered message headers Harald Nordgren via GitGitGadget
2026-10-27  8:31   ` [PATCH v4 1/4] imap-send: wait for the tunnel command to finish Harald Nordgren via GitGitGadget
2026-10-27  8:31   ` [PATCH v4 2/4] imap-send: accept messages with Subject before Date Harald Nordgren via GitGitGadget
2026-10-30 22:51     ` Junio C Hamano
2026-10-31  7:58       ` Harald Nordgren
2026-10-27  8:31   ` [PATCH v4 3/4] imap-send: check git send-email copies like other messages Harald Nordgren via GitGitGadget
2026-10-27 10:59     ` Patrick Steinhardt
2026-10-27  8:31   ` [PATCH v4 4/4] imap-send: match header names case insensitively Harald Nordgren via GitGitGadget
2026-10-27 10:59   ` [PATCH v4 0/4] Fix imap-send with reordered message headers Patrick Steinhardt
2026-10-29 14:29     ` Junio C Hamano
2026-11-01  8:21 ` [PATCH v5 0/4] imap-send: fix " Harald Nordgren via GitGitGadget
2026-11-01  8:21   ` [PATCH v5 1/4] imap-send: wait for the tunnel command to finish Harald Nordgren via GitGitGadget
2026-11-01  8:21   ` [PATCH v5 2/4] imap-send: accept messages with Subject before Date Harald Nordgren via GitGitGadget
2026-11-16  7:44     ` Patrick Steinhardt [this message]
2026-11-01  8:21   ` [PATCH v5 3/4] imap-send: check git send-email copies like other messages Harald Nordgren via GitGitGadget
2026-11-01  8:21   ` [PATCH v5 4/4] imap-send: match header names case insensitively Harald Nordgren via GitGitGadget
2026-11-11  8:29   ` [PATCH v5 0/4] imap-send: fix with reordered message headers Harald Nordgren

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=avq0R5zx0PgSN-Oa@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=haraldnordgren@gmail.com \
    /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