Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix detection of dynamic cycles #988

Merged
2 commits merged into from Jul 10, 2018
Merged

Fix detection of dynamic cycles #988

2 commits merged into from Jul 10, 2018

Conversation

ghost
Copy link

@ghost ghost commented Jul 10, 2018

This PR fixes an issue we observed yesterday with @xclerc where dune silently exit with an error code. The problem was in fact a problem with the detection of cycles that appear dynamically due to dynamic dependencies.

This PR adds as regression test the case we found + two other cases. It then fixes the issue by keeping track of all reverse dependency paths.

@ghost ghost requested review from rgrinberg and emillon July 10, 2018 09:10
; mode = Standard
; loc = None
; dir = Path.root
; exec = Not_started { eval_rule = (fun _ -> assert false)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way to encode this into a new constructor so that these assertions can be removed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to interpret it though. This rule represent the build goal, so it should only terminate when the build is done. We could also create a new rule for every build and make it depend on the requested target. I'm having a look

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit annoying to change actually, so I just added a comment for now. We can look at this in another PR

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK! that's good like this.

List.find t.rev_deps ~f:(fun (_, t) ->
Path.Set.mem t.all_targets last)
with
| None -> assert false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use Option.value_exn here (there's a couple List.find uses like this in the code base, so extracting a List.find_exn is a nice alternative as well)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. I'm using Option.value_exn for now, we can add List.find_exn and change all the occurrences at once in another PR

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I'll take care of this part.

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
It's a smaller set and comparison is quicker

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
@ghost ghost merged commit d7222ae into ocaml:master Jul 10, 2018
@emillon emillon mentioned this pull request Jul 10, 2018
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants