Skip to content

Commit

Permalink
Fix closure computation in the presence of cycles (#3670)
Browse files Browse the repository at this point in the history
When a cycle is present (typically ocaml-base-compiler ⇄ ocaml), relying on the successor to determine if a package should be marked gives an incomplete graph
  • Loading branch information
AltGr authored and rjbou committed Dec 6, 2018
1 parent 471d34c commit 0a6b63e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/solver/opamCudf.ml
Expand Up @@ -178,11 +178,12 @@ module Graph = struct
let _, l =
Topo.fold
(fun pkg (closure, topo) ->
if Set.mem pkg closure then
Set.union closure (Set.of_list (PG.succ g pkg)),
pkg :: topo
else
closure, topo)
if Set.mem pkg closure then
closure, pkg :: topo
else if List.exists (fun p -> Set.mem p closure) (PG.pred g pkg) then
Set.add pkg closure, pkg :: topo
else
closure, topo)
g
(pkgs, []) in
l
Expand Down

0 comments on commit 0a6b63e

Please sign in to comment.