Skip to content

Commit 742e357

Browse files
OfekShimkoShimko
andauthored
fix(piptree): prevent UnboundLocalError by logging path (not current_path) in cycle check (CycloneDX#2359)
* fix UnboundLocalError in find deps Signed-off-by: Shimko <[email protected]> * apply fix also in pipetree.js Signed-off-by: Shimko <[email protected]> --------- Signed-off-by: Shimko <[email protected]> Co-authored-by: Shimko <[email protected]>
1 parent 673f794 commit 742e357

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

contrib/piptree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def find_deps(idx, path, purl, reqs, global_installed, traverse_count):
134134
continue
135135
r.project_name = d.project_name if d is not None else r.project_name
136136
if r.key in path:
137-
print(f"Cycle detected: {' -> '.join(current_path)}")
137+
print(f"Cycle detected: {' -> '.join(path)} -> {r.key}")
138138
continue
139139
current_path = path + [r.key]
140140
specs = sorted(r.specs, reverse=True)

lib/managers/piptree.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def find_deps(idx, path, purl, reqs, global_installed, traverse_count):
152152
continue
153153
r.project_name = d.project_name if d is not None else r.project_name
154154
if r.key in path:
155-
print(f"Cycle detected: {' -> '.join(current_path)}")
155+
print(f"Cycle detected: {' -> '.join(path)} -> {r.key}")
156156
continue
157157
current_path = path + [r.key]
158158
specs = sorted(r.specs, reverse=True)

0 commit comments

Comments
 (0)