App.get_project_refs(): Fix multi-section results #117
Loading…
Reference in a new issue
No description provided.
Delete branch "jan/fix/20260922-app-get-project-refs-fix-multi-section-results"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
App.get_project_refs(): Fix multi-section results
get_project_refs() takes a list of sections to look for references in. To now, that has never been exercised, i.e. only one section had ever been passed in. With the introduction of pkg.recommends, that could change now, and it has a subtle bug.
Say, a caller wants to retrieve all requires and recommends of package A with this graph:
A recommends B, requires nothing B requires C
then A, B, C should be returned, but the current implementation only returns A and B. The cause is that every section is recursed into in isolation, and the union of all results is returned. Since A doesn't require anything, the requires-branch never reaches B, and C is missed.
The fix is to make __get_project_refs(), the recursing method, take a list of sections instead of one section, and decide if it recurses deeper based on all of its entries at every depth.