sbom: T8542: bugfix shadowing cmd() function with cmd variable name - #1216
Conversation
Commit 75a495b ("sbom: T8542: create during ISO assembly") will shadow any subsequent calls to vyos.utils.process.cmd() as cmd has be redefined as variable to hold the CLI command strings for SBOM generation using the syft binary. This has been fixed by replacing the cmd variable with another name syft_cmd.
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2026-06-01T00:03:20.253ZApplied to files:
🔍 Remote MCPI'll search for relevant context about the SBOM generation tools and the shadowing issue to help inform the review of this PR.## Summary of Additional Context Based on my search, here is the relevant information for reviewing this PR: Understanding Syft and SBOM GenerationSyft is a CLI tool for generating SBOMs that supports multiple output formats including CycloneDX and SPDX. Syft is Anchore's open source SBOM generation tool that supports a broad range of package ecosystems and can scan source directories, container images, and archive files. CycloneDX and SPDX are the most popular SBOM formats, both of which Syft supports. In the VyOS build context, the SBOM generation section uses Variable Shadowing Issue DetailsThe fix addresses a classic variable shadowing problem. Variable shadowing in Python is when a local variable within a function hides a variable from an outer scope because they both have the same name, and if a local variable within a function is given the same name as a global variable, Python shadows the global variable and any use of that variable name within the function definition will reference the newly created local variable. Variable shadowing can change the outputs of functions and produce unexpected results if you are not aware of it, and it is considered good practice to avoid variable shadowing by following the correct naming conventions and giving identifiers within your code unique names. In this case, the local variable Key Points for Review
🔇 Additional comments (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughRename of the SBOM command list variable from ChangesSBOM Command List Refactoring
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches✨ Simplify code
Comment |
jestabro
left a comment
There was a problem hiding this comment.
Fix var name to avoid collision with function name.
|
CI integration 👍 passed! Details
|
Change summary
Commit 75a495b (
sbom: T8542: create during ISO assembly) will shadow any subsequent calls tovyos.utils.process.cmd()as cmd has be redefined as variable to hold the CLI command strings for SBOM generation using thesyftbinary.This has been fixed by replacing the cmd variable with another name syft_cmd.
Types of changes
Related Task(s)
Checklist: