Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] utils/generate-cyclonedx: fix monotonically increasing dependency list
@ 2025-10-07 17:40 Nevo Hed via buildroot
  2025-10-07 19:31 ` Nevo Hed via buildroot
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Nevo Hed via buildroot @ 2025-10-07 17:40 UTC (permalink / raw)
  To: buildroot; +Cc: Nevo Hed, Thomas Perale

From: Nevo Hed <nhed+github@starry.com>

Having mutables as default args has unexpected behaviors.
br2_parse_deps_recursively had a default arg `deps` initialized to the
empty list (`[]`) except that on subsequent calls from `main` deps would
already be populated from prior components.
---
 utils/generate-cyclonedx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/utils/generate-cyclonedx b/utils/generate-cyclonedx
index 60983ac1ea..7d3ef57ab3 100755
--- a/utils/generate-cyclonedx
+++ b/utils/generate-cyclonedx
@@ -238,7 +238,7 @@ def cyclonedx_vulnerabilities(show_info_dict):
     } for cve, components in cves.items()]
 
 
-def br2_parse_deps_recursively(ref, show_info_dict, virtual=False, deps=[]):
+def br2_parse_deps_recursively(ref, show_info_dict, virtual=False, deps=None):
     """Parse dependencies from the show-info output. This function will
     recursively collect all dependencies, and return a list where each dependency
     is stated at most once.
@@ -258,6 +258,8 @@ def br2_parse_deps_recursively(ref, show_info_dict, virtual=False, deps=[]):
     Returns:
         list: A list of dependencies of the 'ref' package.
     """
+    if deps is None:
+        deps = []
     for dep in show_info_dict.get(ref, {}).get("dependencies", []):
         if dep not in deps:
             if virtual or show_info_dict.get(dep, {}).get("virtual") is False:
-- 
2.51.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2025-12-26 19:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-07 17:40 [Buildroot] [PATCH] utils/generate-cyclonedx: fix monotonically increasing dependency list Nevo Hed via buildroot
2025-10-07 19:31 ` Nevo Hed via buildroot
2025-10-07 20:07 ` Thomas Perale via buildroot
2025-11-20 22:32 ` Thomas Petazzoni via buildroot
2025-12-02 21:34   ` Nevo Hed via buildroot
2025-12-03  7:46     ` Thomas Petazzoni via buildroot
     [not found] ` <20251226041452.1040838-1-nhed+github@starry.com>
     [not found]   ` <20251226041452.1040838-2-nhed+github@starry.com>
2025-12-26 19:55     ` [Buildroot] [PATCH v2 1/1] " Nevo Hed via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox