All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] classes/sbom-cve-check: fall back to the stable SBOM symlink
@ 2026-08-04 11:24 roosesweb
  2026-08-17 19:10 ` Paul Barker
  0 siblings, 1 reply; 14+ messages in thread
From: roosesweb @ 2026-08-04 11:24 UTC (permalink / raw)
  To: openembedded-core; +Cc: Thomas Roos

do_sbom_cve_check builds its input path from ${IMAGE_NAME}, which carries
${IMAGE_VERSION_SUFFIX} and so ${DATETIME}. That value is excluded from task
hashes but changes on every bitbake invocation, so the path is only correct when
do_create_image_sbom_spdx ran in the same invocation.

It does not when the class is newly enabled on an existing build tree: the image
SBOM is already deployed and stamped from an earlier build, do_sbom_cve_check has
never run, so bitbake executes only the latter and it looks for a file whose
timestamp belongs to the current invocation. The same happens on any forced re-run
of just this task:

  $ bitbake -f -c sbom_cve_check core-image-minimal
  ERROR: core-image-minimal-1.0-r0 do_sbom_cve_check: sbom-cve-check failed: [...]
  sbom-cve-check: error: [Errno 2] No such file or directory:
    '.../core-image-minimal-qemux86-64.rootfs-20260804101106.spdx.json'

  $ ls tmp/deploy/images/qemux86-64/*.spdx.json
  core-image-minimal-qemux86-64.rootfs-20260804095834.spdx.json
  core-image-minimal-qemux86-64.rootfs.spdx.json -> ...-20260804095834.spdx.json

The file is there under ${IMAGE_LINK_NAME}, the symlink do_create_image_sbom_spdx
maintains. Keep preferring the timestamped name, so behaviour is unchanged whenever
it exists, and fall back to the symlink rather than failing. Guarded on link_name
being set, since IMAGE_LINK_NAME can be empty.

Signed-off-by: Thomas Roos <roosesweb@gmail.com>
---
 meta/classes-recipe/sbom-cve-check.bbclass | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/meta/classes-recipe/sbom-cve-check.bbclass b/meta/classes-recipe/sbom-cve-check.bbclass
index 451595f..b184c12 100644
--- a/meta/classes-recipe/sbom-cve-check.bbclass
+++ b/meta/classes-recipe/sbom-cve-check.bbclass
@@ -14,9 +14,20 @@ python do_sbom_cve_check() {
     """
     Task: Run sbom-cve-check analysis on SBOM.
     """
-    sbom_path = d.expand("${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.spdx.json")
+    import os
+
     image_name = d.getVar("IMAGE_NAME")
     link_name = d.getVar("IMAGE_LINK_NAME")
+    deploy_dir = d.getVar("DEPLOY_DIR_IMAGE")
+
+    # IMAGE_NAME carries DATETIME, which changes on every invocation while being
+    # excluded from task hashes, so this path is only valid when
+    # do_create_image_sbom_spdx ran in the same invocation. Fall back to the
+    # symlink it maintains, which is stable across builds.
+    sbom_path = os.path.join(deploy_dir, "%s.spdx.json" % image_name)
+    if not os.path.exists(sbom_path) and link_name:
+        sbom_path = os.path.join(deploy_dir, "%s.spdx.json" % link_name)
+
     run_sbom_cve_check(d, sbom_path, image_name, link_name)
 }
 
-- 
2.55.0



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] classes/sbom-cve-check: fall back to the stable SBOM symlink
  2026-08-04 11:24 [PATCH] classes/sbom-cve-check: fall back to the stable SBOM symlink roosesweb
@ 2026-08-17 19:10 ` Paul Barker
  2026-08-19  6:22   ` [PATCH v2 0/5] Handle an empty IMAGE_LINK_NAME consistently Thomas Roos
  2026-08-19  6:30   ` [PATCH] classes/sbom-cve-check: fall back to the stable SBOM symlink Thomas Roos
  0 siblings, 2 replies; 14+ messages in thread
From: Paul Barker @ 2026-08-17 19:10 UTC (permalink / raw)
  To: roosesweb, openembedded-core

On Tue, 2026-08-04 at 13:24 +0200, roosesweb@gmail.com wrote:
> do_sbom_cve_check builds its input path from ${IMAGE_NAME}, which carries
> ${IMAGE_VERSION_SUFFIX} and so ${DATETIME}. That value is excluded from task
> hashes but changes on every bitbake invocation, so the path is only correct when
> do_create_image_sbom_spdx ran in the same invocation.
> 
> It does not when the class is newly enabled on an existing build tree: the image
> SBOM is already deployed and stamped from an earlier build, do_sbom_cve_check has
> never run, so bitbake executes only the latter and it looks for a file whose
> timestamp belongs to the current invocation. The same happens on any forced re-run
> of just this task:
> 
>   $ bitbake -f -c sbom_cve_check core-image-minimal
>   ERROR: core-image-minimal-1.0-r0 do_sbom_cve_check: sbom-cve-check failed: [...]
>   sbom-cve-check: error: [Errno 2] No such file or directory:
>     '.../core-image-minimal-qemux86-64.rootfs-20260804101106.spdx.json'
> 
>   $ ls tmp/deploy/images/qemux86-64/*.spdx.json
>   core-image-minimal-qemux86-64.rootfs-20260804095834.spdx.json
>   core-image-minimal-qemux86-64.rootfs.spdx.json -> ...-20260804095834.spdx.json
> 
> The file is there under ${IMAGE_LINK_NAME}, the symlink do_create_image_sbom_spdx
> maintains. Keep preferring the timestamped name, so behaviour is unchanged whenever
> it exists, and fall back to the symlink rather than failing. Guarded on link_name
> being set, since IMAGE_LINK_NAME can be empty.
> 
> Signed-off-by: Thomas Roos <roosesweb@gmail.com>

Hi Thomas,

This code has already changed recently in commit 2a80840a4fe0
("sbom-cve-check: Fix breakage with empty IMAGE_LINK_NAME"). Perhaps we
should have just added a fallback to IMAGE_NAME if IMAGE_LINK_NAME is
unset.

A quick scan of the code shows that there are other places where it is
assumed that IMAGE_LINK_NAME is valid, such as vex.bbclass.

Best regards,

-- 
Paul Barker




^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2 0/5] Handle an empty IMAGE_LINK_NAME consistently
  2026-08-17 19:10 ` Paul Barker
@ 2026-08-19  6:22   ` Thomas Roos
  2026-08-19  6:22     ` [PATCH v2 1/5] sbom-cve-check: read the image SBOM through the stable symlink Thomas Roos
                       ` (5 more replies)
  2026-08-19  6:30   ` [PATCH] classes/sbom-cve-check: fall back to the stable SBOM symlink Thomas Roos
  1 sibling, 6 replies; 14+ messages in thread
From: Thomas Roos @ 2026-08-19  6:22 UTC (permalink / raw)
  To: openembedded-core; +Cc: Paul Barker

v1 fixed the sbom-cve-check input path. Paul noted that 2a80840a4fe0
("sbom-cve-check: Fix breakage with empty IMAGE_LINK_NAME") had already
touched this class, and that other classes make the same assumption. That
commit guarded the export symlinks; the input path is separate and still
built from IMAGE_NAME. Patch 1 now uses the shape Paul suggested, and
patches 2-4 fix the other sites found by auditing meta/classes*,
meta/lib/oe and meta/lib/oeqa.

Read and write sites need opposite handling of an empty value: read sites
fall back to IMAGE_NAME, write sites skip the link. A central default (pin
IMAGE_LINK_NAME to IMAGE_NAME when empty) does not work, as create_symlinks
and multiubi_mkfs have no link != target check and IMAGE_NAME is itself
derived from IMAGE_LINK_NAME.

Tested on qemux86-64, each fix confirmed in both directions. Patch 5 covers
patches 2-4 in one build; patch 1 was checked by hand, as a selftest would
need the sbom-cve-check databases (~8.7G of git).

AI-Generated: Uses Claude Opus 5

Thomas Roos (5):
  sbom-cve-check: read the image SBOM through the stable symlink
  vex: skip the VEX symlink when IMAGE_LINK_NAME is empty
  testexport: fall back to IMAGE_NAME when IMAGE_LINK_NAME is empty
  image_types: skip multiubi symlinks when IMAGE_LINK_NAME is empty
  oeqa/selftest/imagefeatures: test an empty IMAGE_LINK_NAME

 meta/classes-recipe/image_types.bbclass       |  2 +-
 meta/classes-recipe/sbom-cve-check.bbclass    |  3 +-
 meta/classes-recipe/testexport.bbclass        |  2 +-
 meta/classes/vex.bbclass                      |  3 +-
 meta/lib/oeqa/selftest/cases/imagefeatures.py | 42 +++++++++++++++++++
 5 files changed, 48 insertions(+), 4 deletions(-)

-- 
2.55.0



^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2 1/5] sbom-cve-check: read the image SBOM through the stable symlink
  2026-08-19  6:22   ` [PATCH v2 0/5] Handle an empty IMAGE_LINK_NAME consistently Thomas Roos
@ 2026-08-19  6:22     ` Thomas Roos
  2026-08-19  6:22     ` [PATCH v2 2/5] vex: skip the VEX symlink when IMAGE_LINK_NAME is empty Thomas Roos
                       ` (4 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: Thomas Roos @ 2026-08-19  6:22 UTC (permalink / raw)
  To: openembedded-core; +Cc: Paul Barker

The input path was built from IMAGE_NAME, which carries DATETIME and so only
resolves within the invocation that wrote the SBOM: enabling the class on an
existing build tree, or "bitbake -f -c sbom_cve_check", failed with ENOENT.
Read IMAGE_LINK_NAME instead, falling back to IMAGE_NAME when it is unset.

AI-Generated: Uses Claude Opus 5
Signed-off-by: Thomas Roos <roosesweb@gmail.com>
---
 meta/classes-recipe/sbom-cve-check.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/classes-recipe/sbom-cve-check.bbclass b/meta/classes-recipe/sbom-cve-check.bbclass
index 451595f..ca47834 100644
--- a/meta/classes-recipe/sbom-cve-check.bbclass
+++ b/meta/classes-recipe/sbom-cve-check.bbclass
@@ -14,9 +14,10 @@ python do_sbom_cve_check() {
     """
     Task: Run sbom-cve-check analysis on SBOM.
     """
-    sbom_path = d.expand("${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.spdx.json")
     image_name = d.getVar("IMAGE_NAME")
     link_name = d.getVar("IMAGE_LINK_NAME")
+    sbom_path = os.path.join(d.getVar("DEPLOY_DIR_IMAGE"),
+                             "%s.spdx.json" % (link_name or image_name))
     run_sbom_cve_check(d, sbom_path, image_name, link_name)
 }
 
-- 
2.55.0



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 2/5] vex: skip the VEX symlink when IMAGE_LINK_NAME is empty
  2026-08-19  6:22   ` [PATCH v2 0/5] Handle an empty IMAGE_LINK_NAME consistently Thomas Roos
  2026-08-19  6:22     ` [PATCH v2 1/5] sbom-cve-check: read the image SBOM through the stable symlink Thomas Roos
@ 2026-08-19  6:22     ` Thomas Roos
  2026-08-27 13:25       ` Paul Barker
  2026-08-19  6:22     ` [PATCH v2 3/5] testexport: fall back to IMAGE_NAME " Thomas Roos
                       ` (3 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Thomas Roos @ 2026-08-19  6:22 UTC (permalink / raw)
  To: openembedded-core; +Cc: Paul Barker

An empty IMAGE_LINK_NAME left a bare ".vex.json" symlink in the deploy
directory. Skip the link, as image.bbclass and rootfs-postcommands do.

AI-Generated: Uses Claude Opus 5
Signed-off-by: Thomas Roos <roosesweb@gmail.com>
---
 meta/classes/vex.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/classes/vex.bbclass b/meta/classes/vex.bbclass
index b3c2aca..eee3af6 100644
--- a/meta/classes/vex.bbclass
+++ b/meta/classes/vex.bbclass
@@ -204,7 +204,8 @@ python vex_write_rootfs_manifest () {
     with open(manifest_name, "w") as f:
         json.dump(json_data, f, indent=2)
 
-    update_symlinks(manifest_name, link_path)
+    if link_name:
+        update_symlinks(manifest_name, link_path)
     bb.plain("Image VEX JSON report stored in: %s" % manifest_name)
 }
 
-- 
2.55.0



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 3/5] testexport: fall back to IMAGE_NAME when IMAGE_LINK_NAME is empty
  2026-08-19  6:22   ` [PATCH v2 0/5] Handle an empty IMAGE_LINK_NAME consistently Thomas Roos
  2026-08-19  6:22     ` [PATCH v2 1/5] sbom-cve-check: read the image SBOM through the stable symlink Thomas Roos
  2026-08-19  6:22     ` [PATCH v2 2/5] vex: skip the VEX symlink when IMAGE_LINK_NAME is empty Thomas Roos
@ 2026-08-19  6:22     ` Thomas Roos
  2026-08-19  6:22     ` [PATCH v2 4/5] image_types: skip multiubi symlinks " Thomas Roos
                       ` (2 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: Thomas Roos @ 2026-08-19  6:22 UTC (permalink / raw)
  To: openembedded-core; +Cc: Paul Barker

copy_needed_files() built the manifest and testdata paths from
IMAGE_LINK_NAME alone, so an empty value made it copy ".manifest" and fail.
testexport_main() in the same file already falls back to IMAGE_NAME.

AI-Generated: Uses Claude Opus 5
Signed-off-by: Thomas Roos <roosesweb@gmail.com>
---
 meta/classes-recipe/testexport.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes-recipe/testexport.bbclass b/meta/classes-recipe/testexport.bbclass
index 12b7e17..a0be7cd 100644
--- a/meta/classes-recipe/testexport.bbclass
+++ b/meta/classes-recipe/testexport.bbclass
@@ -134,7 +134,7 @@ def copy_needed_files(d, tc):
 
     # Copy test data
     image_name = ("%s/%s" % (d.getVar('DEPLOY_DIR_IMAGE'),
-                            d.getVar('IMAGE_LINK_NAME')))
+                            d.getVar('IMAGE_LINK_NAME') or d.getVar('IMAGE_NAME')))
     image_manifest = "%s.manifest" % image_name
     tdname = "%s.testdata.json" % image_name
     test_data_path = os.path.join(export_path, 'data')
-- 
2.55.0



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 4/5] image_types: skip multiubi symlinks when IMAGE_LINK_NAME is empty
  2026-08-19  6:22   ` [PATCH v2 0/5] Handle an empty IMAGE_LINK_NAME consistently Thomas Roos
                       ` (2 preceding siblings ...)
  2026-08-19  6:22     ` [PATCH v2 3/5] testexport: fall back to IMAGE_NAME " Thomas Roos
@ 2026-08-19  6:22     ` Thomas Roos
  2026-08-19  6:22     ` [PATCH v2 5/5] oeqa/selftest/imagefeatures: test an empty IMAGE_LINK_NAME Thomas Roos
  2026-08-27 15:37     ` [PATCH v2 0/5] Handle an empty IMAGE_LINK_NAME consistently Paul Barker
  5 siblings, 0 replies; 14+ messages in thread
From: Thomas Roos @ 2026-08-19  6:22 UTC (permalink / raw)
  To: openembedded-core; +Cc: Paul Barker

An empty IMAGE_LINK_NAME made multiubi_mkfs link the named volumes from the
suffix alone, e.g. "_volume.ubifs". Guard the block.

AI-Generated: Uses Claude Opus 5
Signed-off-by: Thomas Roos <roosesweb@gmail.com>
---
 meta/classes-recipe/image_types.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes-recipe/image_types.bbclass b/meta/classes-recipe/image_types.bbclass
index ca13729..6c620a5 100644
--- a/meta/classes-recipe/image_types.bbclass
+++ b/meta/classes-recipe/image_types.bbclass
@@ -217,7 +217,7 @@ multiubi_mkfs() {
 	mv ubinize${vname}-${IMAGE_NAME}.cfg ${IMGDEPLOYDIR}/
 
 	# Create own symlinks for 'named' volumes
-	if [ -n "$vname" ]; then
+	if [ -n "$vname" ] && [ -n "${IMAGE_LINK_NAME}" ]; then
 		cd ${IMGDEPLOYDIR}
 		if [ -e ${IMAGE_NAME}${vname}.ubifs ]; then
 			ln -sf ${IMAGE_NAME}${vname}.ubifs \
-- 
2.55.0



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 5/5] oeqa/selftest/imagefeatures: test an empty IMAGE_LINK_NAME
  2026-08-19  6:22   ` [PATCH v2 0/5] Handle an empty IMAGE_LINK_NAME consistently Thomas Roos
                       ` (3 preceding siblings ...)
  2026-08-19  6:22     ` [PATCH v2 4/5] image_types: skip multiubi symlinks " Thomas Roos
@ 2026-08-19  6:22     ` Thomas Roos
  2026-08-27 15:37     ` [PATCH v2 0/5] Handle an empty IMAGE_LINK_NAME consistently Paul Barker
  5 siblings, 0 replies; 14+ messages in thread
From: Thomas Roos @ 2026-08-19  6:22 UTC (permalink / raw)
  To: openembedded-core; +Cc: Paul Barker

Nothing covered this configuration, which is why the vex, multiubi and
testexport sites went unnoticed. One core-image-minimal build with
IMAGE_LINK_NAME cleared covers all three; the test fails without them.

AI-Generated: Uses Claude Opus 5
Signed-off-by: Thomas Roos <roosesweb@gmail.com>
---
 meta/lib/oeqa/selftest/cases/imagefeatures.py | 42 +++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/imagefeatures.py b/meta/lib/oeqa/selftest/cases/imagefeatures.py
index 87c3da2..fac1d47 100644
--- a/meta/lib/oeqa/selftest/cases/imagefeatures.py
+++ b/meta/lib/oeqa/selftest/cases/imagefeatures.py
@@ -332,3 +332,45 @@ CORE_IMAGE_EXTRA_INSTALL = "man-pages"
             status, output = qemu.run_serial("man --pager=cat intro")
             self.assertEqual(status, 1, 'Failed to run man: %s' % (output))
             self.assertIn("introduction to user commands", output)
+
+    def test_empty_image_link_name(self):
+        """
+        Test that an empty IMAGE_LINK_NAME suppresses the artifact symlinks
+        and that the classes reading an artifact back still locate it.
+        """
+        image = 'core-image-minimal'
+        vname = 'mtd_4_256'
+        config = """
+INHERIT += "vex"
+IMAGE_CLASSES += "testexport"
+IMAGE_LINK_NAME = ""
+IMAGE_NAME = "${IMAGE_BASENAME}${IMAGE_MACHINE_SUFFIX}${IMAGE_NAME_SUFFIX}"
+IMAGE_FSTYPES += "multiubi"
+MULTIUBI_BUILD = "%s"
+MKUBIFS_ARGS_%s ?= "-m 4096 -e 253952 -c 4096"
+UBINIZE_ARGS_%s ?= "-m 4096 -p 256KiB"
+TEST_TARGET_IP = "192.168.7.2"
+TEST_SERVER_IP = "192.168.7.1"
+""" % (vname, vname, vname)
+        self.write_config(config)
+
+        bitbake(image)
+        bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_NAME', 'TEST_EXPORT_DIR'], image)
+        deploy_dir = bb_vars['DEPLOY_DIR_IMAGE']
+
+        # Artifacts are still named after IMAGE_NAME
+        for name in ("%s.vex.json" % bb_vars['IMAGE_NAME'],
+                     "%s_%s.ubifs" % (bb_vars['IMAGE_NAME'], vname)):
+            self.assertTrue(os.path.exists(os.path.join(deploy_dir, name)),
+                            "%s is missing from %s" % (name, deploy_dir))
+
+        # ...and nothing is linked from the suffix alone
+        for name in (".vex.json", "_%s.ubifs" % vname, "_%s.ubi" % vname):
+            self.assertFalse(os.path.lexists(os.path.join(deploy_dir, name)),
+                             "%s was created from an empty IMAGE_LINK_NAME" % name)
+
+        # testexport copies these back out of DEPLOY_DIR_IMAGE
+        bitbake("-c testexport %s" % image)
+        for name in ('manifest', 'testdata.json'):
+            path = os.path.join(bb_vars['TEST_EXPORT_DIR'], 'data', name)
+            self.assertTrue(os.path.exists(path), "%s was not exported" % path)
-- 
2.55.0



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] classes/sbom-cve-check: fall back to the stable SBOM symlink
  2026-08-17 19:10 ` Paul Barker
  2026-08-19  6:22   ` [PATCH v2 0/5] Handle an empty IMAGE_LINK_NAME consistently Thomas Roos
@ 2026-08-19  6:30   ` Thomas Roos
  2026-12-01 15:50     ` Vincent Prince
  1 sibling, 1 reply; 14+ messages in thread
From: Thomas Roos @ 2026-08-19  6:30 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

Hi Paul,
updated patch and added also a fix for the other places. Together with a test case.
Let me know if such patches are not welcome, acc. to the discussion of yesterdays engineering sync.
I do not want to loose my reputation and end up in hell ;)
I just want to contribute a bit back to the greatest project in the world!
So please tell me!

Cheers, Thomas

[-- Attachment #2: Type: text/html, Size: 409 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/5] vex: skip the VEX symlink when IMAGE_LINK_NAME is empty
  2026-08-19  6:22     ` [PATCH v2 2/5] vex: skip the VEX symlink when IMAGE_LINK_NAME is empty Thomas Roos
@ 2026-08-27 13:25       ` Paul Barker
  2026-08-27 14:04         ` Paul Barker
  0 siblings, 1 reply; 14+ messages in thread
From: Paul Barker @ 2026-08-27 13:25 UTC (permalink / raw)
  To: Thomas Roos, openembedded-core

On Wed, 2026-08-19 at 08:22 +0200, Thomas Roos wrote:
> An empty IMAGE_LINK_NAME left a bare ".vex.json" symlink in the deploy
> directory. Skip the link, as image.bbclass and rootfs-postcommands do.
> 
> AI-Generated: Uses Claude Opus 5
> Signed-off-by: Thomas Roos <roosesweb@gmail.com>
> ---
>  meta/classes/vex.bbclass | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/vex.bbclass b/meta/classes/vex.bbclass
> index b3c2aca..eee3af6 100644
> --- a/meta/classes/vex.bbclass
> +++ b/meta/classes/vex.bbclass
> @@ -204,7 +204,8 @@ python vex_write_rootfs_manifest () {
>      with open(manifest_name, "w") as f:
>          json.dump(json_data, f, indent=2)
>  
> -    update_symlinks(manifest_name, link_path)
> +    if link_name:
> +        update_symlinks(manifest_name, link_path)

Using link_name in the conditional and link_path in the function
argument is confusing. Perhaps we should move the link_path assignment
inside this conditional? It's not used anywhere else.

    if link_name:
        link_path = os.path.join(deploy_dir, "%s.vex.json" % link_name)
        update_symlinks(manifest_name, link_path)

Best regards,

-- 
Paul Barker



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/5] vex: skip the VEX symlink when IMAGE_LINK_NAME is empty
  2026-08-27 13:25       ` Paul Barker
@ 2026-08-27 14:04         ` Paul Barker
  0 siblings, 0 replies; 14+ messages in thread
From: Paul Barker @ 2026-08-27 14:04 UTC (permalink / raw)
  To: Thomas Roos, openembedded-core

On Thu, 2026-08-27 at 14:25 +0100, Paul Barker wrote:
> On Wed, 2026-08-19 at 08:22 +0200, Thomas Roos wrote:
> > An empty IMAGE_LINK_NAME left a bare ".vex.json" symlink in the deploy
> > directory. Skip the link, as image.bbclass and rootfs-postcommands do.
> > 
> > AI-Generated: Uses Claude Opus 5
> > Signed-off-by: Thomas Roos <roosesweb@gmail.com>
> > ---
> >  meta/classes/vex.bbclass | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/meta/classes/vex.bbclass b/meta/classes/vex.bbclass
> > index b3c2aca..eee3af6 100644
> > --- a/meta/classes/vex.bbclass
> > +++ b/meta/classes/vex.bbclass
> > @@ -204,7 +204,8 @@ python vex_write_rootfs_manifest () {
> >      with open(manifest_name, "w") as f:
> >          json.dump(json_data, f, indent=2)
> >  
> > -    update_symlinks(manifest_name, link_path)
> > +    if link_name:
> > +        update_symlinks(manifest_name, link_path)
> 
> Using link_name in the conditional and link_path in the function
> argument is confusing. Perhaps we should move the link_path assignment
> inside this conditional? It's not used anywhere else.
> 
>     if link_name:
>         link_path = os.path.join(deploy_dir, "%s.vex.json" % link_name)
>         update_symlinks(manifest_name, link_path)

Actually, ignore this, I'm going in the wrong direction here.... I'll
reply to the cover letter about the whole series.

Sorry for the noise!

-- 
Paul Barker



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 0/5] Handle an empty IMAGE_LINK_NAME consistently
  2026-08-19  6:22   ` [PATCH v2 0/5] Handle an empty IMAGE_LINK_NAME consistently Thomas Roos
                       ` (4 preceding siblings ...)
  2026-08-19  6:22     ` [PATCH v2 5/5] oeqa/selftest/imagefeatures: test an empty IMAGE_LINK_NAME Thomas Roos
@ 2026-08-27 15:37     ` Paul Barker
  2026-09-03  8:07       ` Thomas Roos
  5 siblings, 1 reply; 14+ messages in thread
From: Paul Barker @ 2026-08-27 15:37 UTC (permalink / raw)
  To: Thomas Roos, openembedded-core

On Wed, 2026-08-19 at 08:22 +0200, Thomas Roos wrote:
> v1 fixed the sbom-cve-check input path. Paul noted that 2a80840a4fe0
> ("sbom-cve-check: Fix breakage with empty IMAGE_LINK_NAME") had already
> touched this class, and that other classes make the same assumption. That
> commit guarded the export symlinks; the input path is separate and still
> built from IMAGE_NAME. Patch 1 now uses the shape Paul suggested, and
> patches 2-4 fix the other sites found by auditing meta/classes*,
> meta/lib/oe and meta/lib/oeqa.
> 
> Read and write sites need opposite handling of an empty value: read sites
> fall back to IMAGE_NAME, write sites skip the link. A central default (pin
> IMAGE_LINK_NAME to IMAGE_NAME when empty) does not work, as create_symlinks
> and multiubi_mkfs have no link != target check and IMAGE_NAME is itself
> derived from IMAGE_LINK_NAME.
> 
> Tested on qemux86-64, each fix confirmed in both directions. Patch 5 covers
> patches 2-4 in one build; patch 1 was checked by hand, as a selftest would
> need the sbom-cve-check databases (~8.7G of git).
> 
> AI-Generated: Uses Claude Opus 5

Hi Thomas,

I discussed this with Richard, we want to avoid increasing the
complexity of the code unnecessarily.

IMAGE_LINK_NAME is intended to always be valid, we need the link because
IMAGE_NAME is dependent on the date and time that an image was built. Do
we really need to support the case where IMAGE_LINK_NAME is unset?

If we don't need to support IMAGE_LINK_NAME being unset then perhaps we
should just print a better error message in that case and give up.

Best regards,

-- 
Paul Barker



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 0/5] Handle an empty IMAGE_LINK_NAME consistently
  2026-08-27 15:37     ` [PATCH v2 0/5] Handle an empty IMAGE_LINK_NAME consistently Paul Barker
@ 2026-09-03  8:07       ` Thomas Roos
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Roos @ 2026-09-03  8:07 UTC (permalink / raw)
  To: Paul Barker; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 4657 bytes --]

Hi Paul,

Retested the original do_sbom_cve_check bug.
If you enable the sbom_cve_check class after a successful build it fails as
do_create_image_sbom_spdx stays cached from the earlier build and its
output keeps the old build's DATETIME. Result:

  sbom-cve-check: error: [Errno 2] No such file or directory:
    '.../core-image-minimal-qemux86-64.rootfs-20260902135131.spdx.json'

Before: path built as ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.spdx.json as
IMAGE_NAME carries DATETIME, so it only matches the SBOM written in the
same bitbake run.

After: build path from IMAGE_LINK_NAME instead (link_name or image_name,
falls back when link name empty). IMAGE_LINK_NAME is the stable,
non-timestamped symlink do_create_image_sbom_spdx maintains pointing at the
current SBOM. create-spdx-image-3.0.bbclass keeps it updated to the latest
build's file. Reading through it means do_sbom_cve_check finds the SBOM
regardless of which invocation wrote it, since the symlink always points
at the current one, not just this run's timestamp.

bitbake core-image-minimal                            # build once, class
not yet enabled
bitbake-config-build --set-fragment sbom-cve-check   # or add fragment
manually
git checkout 1a32e30~1 -- meta/classes-recipe/sbom-cve-check.bbclass   #
pre-fix code
bitbake core-image-minimal                            # ENOENT on
do_sbom_cve_check
git checkout HEAD -- meta/classes-recipe/sbom-cve-check.bbclass        #
restore fix
bitbake -c sbom_cve_check core-image-minimal -f                        #
succeeds

The pattern is pre-existing, not part of this series,  it was already
established:

  - meta/classes-recipe/testexport.bbclass:52 (testexport_main()) —
d.getVar('IMAGE_LINK_NAME') or d.getVar('IMAGE_NAME')
  - meta/classes-recipe/testimage.bbclass:228 — same IMAGE_LINK_NAME or
IMAGE_NAME fallback, reading testdata.json back

Plus the empty-guard pattern (skip symlink creation rather than fail):

  - meta/classes-recipe/image.bbclass:610 (create_symlinks) — if not
link_name: return
  - meta/classes-recipe/rootfs-postcommands.bbclass:402,479
(write_image_manifest) — if ... and link_name
  - meta/classes-recipe/qemuboot.bbclass:147 — if
d.getVar('IMAGE_LINK_NAME'): before writing the symlink
  - meta/classes-recipe/kernel.bbclass:804 — if [ -n
"${KERNEL_IMAGE_LINK_NAME}" ] before the kernel symlink
  - meta/classes-recipe/license_image.bbclass:300 — same link_name guard
pattern
  - meta/classes-recipe/baremetal-image.bbclass:73 — same

I'm not dying if these series are not merged, I just think this fix is
useful and there are already places using the same pattern!
Please correct me if I'm wrong, also agree on not adding more code
complexity. May a central place is better, but I do not know one!

Cheers, Thomas



Am Do., 27. Aug. 2026 um 17:37 Uhr schrieb Paul Barker <paul@pbarker.dev>:

> On Wed, 2026-08-19 at 08:22 +0200, Thomas Roos wrote:
> > v1 fixed the sbom-cve-check input path. Paul noted that 2a80840a4fe0
> > ("sbom-cve-check: Fix breakage with empty IMAGE_LINK_NAME") had already
> > touched this class, and that other classes make the same assumption. That
> > commit guarded the export symlinks; the input path is separate and still
> > built from IMAGE_NAME. Patch 1 now uses the shape Paul suggested, and
> > patches 2-4 fix the other sites found by auditing meta/classes*,
> > meta/lib/oe and meta/lib/oeqa.
> >
> > Read and write sites need opposite handling of an empty value: read sites
> > fall back to IMAGE_NAME, write sites skip the link. A central default
> (pin
> > IMAGE_LINK_NAME to IMAGE_NAME when empty) does not work, as
> create_symlinks
> > and multiubi_mkfs have no link != target check and IMAGE_NAME is itself
> > derived from IMAGE_LINK_NAME.
> >
> > Tested on qemux86-64, each fix confirmed in both directions. Patch 5
> covers
> > patches 2-4 in one build; patch 1 was checked by hand, as a selftest
> would
> > need the sbom-cve-check databases (~8.7G of git).
> >
> > AI-Generated: Uses Claude Opus 5
>
> Hi Thomas,
>
> I discussed this with Richard, we want to avoid increasing the
> complexity of the code unnecessarily.
>
> IMAGE_LINK_NAME is intended to always be valid, we need the link because
> IMAGE_NAME is dependent on the date and time that an image was built. Do
> we really need to support the case where IMAGE_LINK_NAME is unset?
>
> If we don't need to support IMAGE_LINK_NAME being unset then perhaps we
> should just print a better error message in that case and give up.
>
> Best regards,
>
> --
> Paul Barker
>
>

[-- Attachment #2: Type: text/html, Size: 5302 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] classes/sbom-cve-check: fall back to the stable SBOM symlink
  2026-08-19  6:30   ` [PATCH] classes/sbom-cve-check: fall back to the stable SBOM symlink Thomas Roos
@ 2026-12-01 15:50     ` Vincent Prince
  0 siblings, 0 replies; 14+ messages in thread
From: Vincent Prince @ 2026-12-01 15:50 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 332 bytes --]

Hi,

Thanks for your patch, I needed it to perform generation.
I see there is a variant on this yocto repo to get that fallback
https://git.yoctoproject.org/poky-ci-archive/tree/meta/classes-recipe/sbom-cve-check.bbclass?id=6462b7489255bef3fabc62c0e8e74130b6eb4a9e

Any news about its integration ?

Best regards,
Vincent

[-- Attachment #2: Type: text/html, Size: 567 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-12-01 15:50 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-04 11:24 [PATCH] classes/sbom-cve-check: fall back to the stable SBOM symlink roosesweb
2026-08-17 19:10 ` Paul Barker
2026-08-19  6:22   ` [PATCH v2 0/5] Handle an empty IMAGE_LINK_NAME consistently Thomas Roos
2026-08-19  6:22     ` [PATCH v2 1/5] sbom-cve-check: read the image SBOM through the stable symlink Thomas Roos
2026-08-19  6:22     ` [PATCH v2 2/5] vex: skip the VEX symlink when IMAGE_LINK_NAME is empty Thomas Roos
2026-08-27 13:25       ` Paul Barker
2026-08-27 14:04         ` Paul Barker
2026-08-19  6:22     ` [PATCH v2 3/5] testexport: fall back to IMAGE_NAME " Thomas Roos
2026-08-19  6:22     ` [PATCH v2 4/5] image_types: skip multiubi symlinks " Thomas Roos
2026-08-19  6:22     ` [PATCH v2 5/5] oeqa/selftest/imagefeatures: test an empty IMAGE_LINK_NAME Thomas Roos
2026-08-27 15:37     ` [PATCH v2 0/5] Handle an empty IMAGE_LINK_NAME consistently Paul Barker
2026-09-03  8:07       ` Thomas Roos
2026-08-19  6:30   ` [PATCH] classes/sbom-cve-check: fall back to the stable SBOM symlink Thomas Roos
2026-12-01 15:50     ` Vincent Prince

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.