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

ocamldep -sort returns success despite cyclic files warning #7710

Closed
vicuna opened this Issue Jan 15, 2018 · 2 comments

Comments

Projects
None yet
1 participant
@vicuna
Copy link
Collaborator

vicuna commented Jan 15, 2018

Original bug ID: 7710
Reporter: baileyparker
Status: resolved (set by @xavierleroy on 2018-02-11T13:55:42Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.06.0
Target version: 4.07.0+dev/beta2/rc1/rc2
Fixed in version: 4.07.0+dev/beta2/rc1/rc2
Category: tools (ocaml{lex,yacc,dep,debug,...})
Monitored by: @nojb @dbuenzli

Bug description

If you try running ocamldep on mli files that cyclicly reference eachother, you receive a warning printed to stderr, but ocamldep still prints an ordering and returns 0.

Given that cyclically referencing files are illegal, it should at least return a non-zero status (and probably shouldn't print an order since it is impossible to order cyclically referential files). Currently, when used in a scripting context, you have to (fragilely) search stderr for "Warning: cycle in dependencies." to determine if the output list is actually valid (because if you just try to ocamlc -c *.mli in the returned order you will get an unhelped message that B is unbound--not that there were cyclic references).

Steps to reproduce

a.mli:
type bill = { a : int }
val foo : B.baz -> int

b.mli:
type bar = { a : int; b : int }
val baz : bar -> A.bill -> int

  1. Place the above into files in the same directory
  2. Run ocamldep -sort a.mli b.mli
  3. Notice the "Warning: cycle in dependencies. End of list is not sorted."
  4. Notice echo $? is 0

Additional information

Relevant code:

ocaml/driver/makedepend.ml

Lines 466 to 467 in 8daa184

Format.fprintf Format.err_formatter
"@[Warning: cycle in dependencies. End of list is not sorted.@]@.";

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Jan 22, 2018

Comment author: @xavierleroy

I agree with your analysis. Fix in progress at #1578

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Feb 11, 2018

Comment author: @xavierleroy

Fix merged in trunk.

@vicuna vicuna closed this Feb 11, 2018

@vicuna vicuna added the tools label Mar 14, 2019

@vicuna vicuna added this to the 4.07.0 milestone Mar 14, 2019

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.