All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Antonin Godard" <antonin.godard@bootlin.com>
To: "Quentin Schulz" <quentin.schulz@cherry.de>,
	<docs@lists.yoctoproject.org>
Cc: "Thomas Petazzoni" <thomas.petazzoni@bootlin.com>
Subject: Re: [docs] [PATCH v2] Document shared state signing
Date: Tue, 28 Apr 2026 10:27:23 +0200	[thread overview]
Message-ID: <DI4N955YCS67.3IN39HM7NOLNS@bootlin.com> (raw)
In-Reply-To: <abcb5550-13d9-4873-9ff9-df76e55d7fb9@cherry.de>

Hi,

On Mon Apr 27, 2026 at 6:44 PM CEST, Quentin Schulz wrote:
[...]
>
>>> +            return True
>>>
>>>            import re
>>>            goodsigs = []
>>> @@ -145,6 +148,7 @@ class LocalSigner(object):
>>>
>>>            for sig in valid_sigs.split():
>>>                if sig in goodsigs:
>>> +                bb.note("Signature file %s successfully verified with key %s" % (sig_file, sig))
>>>                    return True
>>>            if len(goodsigs):
>>>                bb.warn('No accepted signatures found. Good signatures
>>> found: %s.' % ' '.join(goodsigs))
>>>
>>>
>>> ? I think we may have a few people resisting this as I'm guessing this
>>> is on the hot path so adding messages isn't the best (even if disabled
>>> most of the time).
>> 
>> I see what you mean. You might be a bit more convincing by passing them through
>> bb.debug?
>> 
>
> Sure, I randomly picked bb.note() but anything will do (though, does it 
> appear in the logs, which is what we're after after all?). Even 
> bb.debug() writes to the mainlogger, so I'm assuming there's *some* cost 
> even if it's not printed. Did you try? Does it work? (Because I just 
> wrote this without even running bitbake with it :D)

I tested this and this works fine. The messages will be printed when passing -v
to bitbake (verbose), so I guess bb.note is fine.

Maybe I'd re-organize a bit and do:

diff --git a/meta/lib/oe/gpg_sign.py b/meta/lib/oe/gpg_sign.py
index ede6186c84f..9024b349ef2 100644
--- a/meta/lib/oe/gpg_sign.py
+++ b/meta/lib/oe/gpg_sign.py
@@ -130,10 +130,6 @@ class LocalSigner(object):
 
         cmd += [sig_file]
         status = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-        # Valid if any key matches if unspecified
-        if not valid_sigs:
-            ret = False if status.returncode else True
-            return ret
 
         import re
         goodsigs = []
@@ -143,8 +139,18 @@ class LocalSigner(object):
             if s:
                 goodsigs += [s.group(1)]
 
+        # Valid if any key matches if unspecified
+        if not valid_sigs:
+            if status.returncode:
+                return False
+
+            bb.note("Signature file %s successfully verified with key(s): %s" %
+                    (sig_file, goodsigs))
+            return True
+
         for sig in valid_sigs.split():
             if sig in goodsigs:
+                bb.note("Signature file %s successfully verified with key %s" % (sig_file, sig))
                 return True
         if len(goodsigs):
             bb.warn('No accepted signatures found. Good signatures found: %s.' % ' '.join(goodsigs))

To show which key on the host verified our file. What do you think?

Antonin


  reply	other threads:[~2026-04-28  8:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21  7:19 [PATCH v2] Document shared state signing Antonin Godard
2026-04-24 15:18 ` [docs] " Quentin Schulz
2026-04-27 14:43   ` Antonin Godard
2026-04-27 15:08     ` Quentin Schulz
2026-04-27 15:33       ` Antonin Godard
2026-04-27 16:44         ` Quentin Schulz
2026-04-28  8:27           ` Antonin Godard [this message]
2026-05-07  9:11             ` Quentin Schulz

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=DI4N955YCS67.3IN39HM7NOLNS@bootlin.com \
    --to=antonin.godard@bootlin.com \
    --cc=docs@lists.yoctoproject.org \
    --cc=quentin.schulz@cherry.de \
    --cc=thomas.petazzoni@bootlin.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.