Linux maintainer tooling and workflows
 help / color / mirror / Atom feed
From: Paul Moore <paul@paul-moore.com>
To: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Cc: tools@linux.kernel.org
Subject: Re: Problems with patatt and stacked-git's patchset cover letter
Date: Thu, 15 Feb 2024 16:55:59 -0500	[thread overview]
Message-ID: <CAHC9VhRt_F9rYEPRtsnbUO4tRN=Y-u7pn5Y8X9N2T2j2+ONnKQ@mail.gmail.com> (raw)
In-Reply-To: <20240214-boa-of-nonconcrete-flowers-2c94cb@lemur>

On Wed, Feb 14, 2024 at 9:57 AM Konstantin Ryabitsev
<konstantin@linuxfoundation.org> wrote:
>
> On Wed, Feb 14, 2024 at 09:13:56AM -0500, Konstantin Ryabitsev wrote:
> > > It looks like some time of check should be done in the patatt example
> > > hook to ensure cover letters are handled correctly.
> >
> > I think the real solution is to fix the bug that's generating invalid headers,
> > not to work around it in patatt. If it's not a bug that's introduced by stgit,
> > then we should take this up with git proper, which I might do anyway.
>
> So, after digging a bit deeper, it seems that the real problem is that
> 'git-send-email --compose' generates a cover letter template that's not what
> is actually going to be sent out. The trouble is that it's then passed to the
> sendemail-validate hook without actually being a valid RFC2822 message.
>
> I've added a change to patatt's hook that will specifically refuse to run when
> it finds evidence of the cover letter template content. Even it it was a valid
> message, we'd still be wrong to sign it, because it will obviously going to be
> modified before it's actually sent out, so the signature would end up being
> invalid anyway.
>
> Paul, would you be willing to test out this change to the hook?
> https://github.com/mricon/patatt/commit/60309eefca64e34a8c15615f45235471824f891d

Of course :)

Unfortunately I ran into problems:

% stg email send -a --to=me --compose --dry-run
/tmp/tOrGhxHdTV/0001-XXX
/tmp/tOrGhxHdTV/0010-XXX
error: `git send-email`: patatt: E: The following required headers not
  present: from
fatal: /home/pcmoore/sources/linux/selinux/.git/.gitsendemail.msg.2ZzrjD.final:
  rejected by sendemail-validate hook
fatal: command 'git hook run --ignore-missing sendemail-validate -- <patch>
  <header>' died with exit code 1
warning: no patches were sent

It looks like keying off the "^GIT: " string is not reliable.  I
believe git/stgit strips those lines before passing the commit to the
hook.

FWIW, my current sendemail-validate (minus some comments to myself)
looks like this, which is based on the git template and it appears to
work fine:

% cat .git/hooks/sendemail-validate
#!/bin/sh
# patatt signing hook
# https://github.com/mricon/patatt

# https://github.com/stacked-git/stgit/issues/414#issuecomment-1937368793
if grep -q "^diff --git " "$1"; then
        exec patatt sign --hook "${1}"
fi

-- 
paul-moore.com

      reply	other threads:[~2024-02-15 21:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAHC9VhRCTKD7qwm7u9EvudWkY9nw+CSS1HCOdr5c8OWBU1LCEg@mail.gmail.com>
2023-12-22 18:09 ` Problems with patatt and stacked-git's patchset cover letter Konstantin Ryabitsev
2023-12-22 22:20   ` Paul Moore
2024-01-08 20:45     ` Konstantin Ryabitsev
2024-02-06 21:00       ` Paul Moore
2024-02-06 21:12         ` Paul Moore
2024-02-13 17:38           ` Paul Moore
2024-02-14 14:13             ` Konstantin Ryabitsev
2024-02-14 14:56               ` Konstantin Ryabitsev
2024-02-15 21:55                 ` Paul Moore [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='CAHC9VhRt_F9rYEPRtsnbUO4tRN=Y-u7pn5Y8X9N2T2j2+ONnKQ@mail.gmail.com' \
    --to=paul@paul-moore.com \
    --cc=konstantin@linuxfoundation.org \
    --cc=tools@linux.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).