3
26
Fork
You've already forked mere
1

Fix uninstall --cascade for multiple independently-required packages #93

Merged
jhuntwork merged 1 commit from uninstall-cascade-multiple-packages into main 2026年07月08日 20:23:45 +02:00

Cascade only ever accounted for the first requested package still
found in the resolution: it computed one cascade round, re-resolved
once, then unconditionally broke out of the loop. A second requested
removal still pulled in by a different, unrelated dependent was never
re-checked against the new resolution - it silently shipped anyway,
with no error and no cascade. Fixed by looping to a fixed point:
re-scan every requested name against the latest resolution until none
of them remain.

That loop surfaced a second, independent bug it happened to newly
reach: the "all roots removed via cascade" branch called
resolution.deinit() and then returned without reassigning resolution,
so the function's outer defer resolution.deinit() fired again on
the same freed value - a double-free. This bug predates this change;
it just needed a second cascade round to ever be reached, and there
were no existing tests for uninstall --cascade at all. Fixed by only
deiniting-then-reassigning when there are roots left to re-resolve.

Added a regression test with two packages independently required by
different dependents; confirmed it reproduces both bugs independently
before landing the fix for either.

Cascade only ever accounted for the first requested package still found in the resolution: it computed one cascade round, re-resolved once, then unconditionally broke out of the loop. A second requested removal still pulled in by a different, unrelated dependent was never re-checked against the new resolution - it silently shipped anyway, with no error and no cascade. Fixed by looping to a fixed point: re-scan every requested name against the latest resolution until none of them remain. That loop surfaced a second, independent bug it happened to newly reach: the "all roots removed via cascade" branch called resolution.deinit() and then returned without reassigning resolution, so the function's outer `defer resolution.deinit()` fired again on the same freed value - a double-free. This bug predates this change; it just needed a second cascade round to ever be reached, and there were no existing tests for uninstall --cascade at all. Fixed by only deiniting-then-reassigning when there are roots left to re-resolve. Added a regression test with two packages independently required by different dependents; confirmed it reproduces both bugs independently before landing the fix for either.
Fix uninstall --cascade for multiple independently-required packages
All checks were successful
/ test (pull_request) Successful in 6m17s
ddfc9768e5
Cascade only ever accounted for the first requested package still
found in the resolution: it computed one cascade round, re-resolved
once, then unconditionally broke out of the loop. A second requested
removal still pulled in by a different, unrelated dependent was never
re-checked against the new resolution - it silently shipped anyway,
with no error and no cascade. Fixed by looping to a fixed point:
re-scan every requested name against the latest resolution until none
of them remain.
That loop surfaced a second, independent bug it happened to newly
reach: the "all roots removed via cascade" branch called
resolution.deinit() and then returned without reassigning resolution,
so the function's outer `defer resolution.deinit()` fired again on
the same freed value - a double-free. This bug predates this change;
it just needed a second cascade round to ever be reached, and there
were no existing tests for uninstall --cascade at all. Fixed by only
deiniting-then-reassigning when there are roots left to re-resolve.
Added a regression test with two packages independently required by
different dependents; confirmed it reproduces both bugs independently
before landing the fix for either.
jhuntwork deleted branch uninstall-cascade-multiple-packages 2026年07月08日 20:23:46 +02:00
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
merelinux/mere!93
Reference in a new issue
merelinux/mere
No description provided.
Delete branch "uninstall-cascade-multiple-packages"

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?