Closed nathannaveen closed 1 year ago
cc @rmetzman
https://github.com/guacsec/guac/pull/1129 This PR fixes the issue but it does not apply the change with the len(parents) from your other fix because the PR hasn't been merged yet.
This gets fixed with https://github.com/guacsec/guac/pull/1129.
Describe the bug
On line 30 of pkg/guacanalytics/toposort.go:
https://github.com/guacsec/guac/blob/bc5c042429c7fa93f993cfef3a7ad2b5f4b1059c/pkg/guacanalytics/toposort.go#L30
I think that it shouldn't be
numNodes <= totalNodes
, and should actually benumNodes < totalNodes
. The reason for this being on line 41:https://github.com/guacsec/guac/blob/bc5c042429c7fa93f993cfef3a7ad2b5f4b1059c/pkg/guacanalytics/toposort.go#L41-L43
We are checking for whether
len(foundIDs) == 0
. IfnumNodes == totalNodes
then we have gone through all the nodes and have no more nodes to find, solen(foundIDs)
will equal0
.I am not sure whether this is intentional because the error message is
fmt.Errorf("error: cycle detected")
, even though in this case there will be no cycle.