Linux maintainer tooling and workflows
 help / color / mirror / Atom feed
From: "Cássio Gabriel" <cassiogabrielcontato@gmail.com>
To: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Cc: "Kernel.org Tools" <tools@kernel.org>
Subject: Re: [PATCH b4] ez: avoid duplicate signatures on resend
Date: Fri, 12 Jun 2026 23:30:09 -0300	[thread overview]
Message-ID: <6c0ffae5-e63c-4968-bc9d-e55678aeba41@gmail.com> (raw)
In-Reply-To: <178105802269.171297.16359053180453686328.b4-review@b4>


[-- Attachment #1.1: Type: text/plain, Size: 2783 bytes --]

Hi!

On 6/9/26 23:20, Konstantin Ryabitsev wrote:
> On Mon, 25 May 2026 01:14:23 -0300, Cássio Gabriel <cassiogabrielcontato@gmail.com> wrote:
>> diff --git a/src/b4/ez.py b/src/b4/ez.py
>> index 3e81138..4f55f0f 100644
>> --- a/src/b4/ez.py
>> +++ b/src/b4/ez.py
>> @@ -1734,6 +1734,15 @@ def get_cover_subject_body(cover: str) -> Tuple[b4.LoreSubject, str]:
>>      return lsubject, cbody
>>  
>>  
>> +def strip_cover_signature(cbody: str) -> str:
>> +    body = cbody.replace('\r', '').rstrip('\n')
>> +    sigpos = max(body.rfind('\n-- \n'), body.rfind('\n--\n'))
>> +    if sigpos >= 0:
>> +        return body[:sigpos].rstrip('\n')
>> +
>> +    return body
> 
> No, you should drop the '\n--\n' (bare, no trailing space) case from
> the sigpos search. The canonical email signature delimiter is '\n-- \n'
> — that trailing space is load-bearing and intentional and we
> deliberately only recognise the canonical form, and for good reason:
> bare '--' appears legitimately in cover letter prose — markdown
> horizontal rules, CLI flag documentation, SQL comments, and various
> other contexts.  Matching it here can silently truncate the cover body
> in ways the author would never expect, and the conservative posture of
> the existing code is the right one. If someone's cover carries '\n--\n'
> from a non-conformant mailer, a doubled footer on resend is a far
> smaller problem than silently eating half the cover text.
> 
> With the bare '--' case removed the sigpos line simplifies to:
> 
>     sigpos = body.rfind('\n-- \n')
> 
> and the '--' parametrize case in the test should be removed too.
> 
> This is the right fix for the resend path. The previous cbody.strip()
> also stripped leading whitespace, which this helper does not -- a minor
> behaviour change worth looking out for in case it wasn't intentional.
> 
>>
>> diff --git a/src/tests/test_ez.py b/src/tests/test_ez.py
>> index 3d05ef9..5abfea2 100644
>> --- a/src/tests/test_ez.py
>> +++ b/src/tests/test_ez.py
>> @@ -408,3 +408,24 @@ def test_store_cover_preserves_series_notes(prepdir_commit: str) -> None:
>> [ ... skip 18 lines ... ]
>> +        'Cover text.\n\n'
>> +        '---\n'
>> +        'base-commit: abc123\n'
>> +        'change-id: 20260101-test-change-id\n\n'
>> +        'Best regards,'
>> +    )
> 
> The '-- ' parametrize case is correct and should be kept. The '--' case
> should be removed along with the bare-delimiter matching in the helper itself.
> Optionally, adding a no-signature case would lock in that the function returns
> the body unchanged (modulo trailing-newline normalization) when no delimiter
> is present.

Thanks for the review.

I'll respin these suggestions in v2.

-- 
Thanks,
Cássio


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

      reply	other threads:[~2026-06-13  2:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-25  4:14 [PATCH b4] ez: avoid duplicate signatures on resend Cássio Gabriel
2026-06-10  2:20 ` Konstantin Ryabitsev
2026-06-13  2:30   ` Cássio Gabriel [this message]

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=6c0ffae5-e63c-4968-bc9d-e55678aeba41@gmail.com \
    --to=cassiogabrielcontato@gmail.com \
    --cc=konstantin@linuxfoundation.org \
    --cc=tools@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