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

result of package "shadow" not reproducible #6

Closed
olafhering opened this issue Apr 2, 2020 · 5 comments · Fixed by ocaml/opam-repository#19314
Closed

result of package "shadow" not reproducible #6

olafhering opened this issue Apr 2, 2020 · 5 comments · Fixed by ocaml/opam-repository#19314

Comments

@olafhering
Copy link

A rebuild of unchanged sources results in different binaries in the shadow package.

It looks like this is the culprit:
src/shadow/gen/gen.ml:15: let files = Sys.readdir dir |> Array.to_list in

The result of readdir() is not stable. I think the list must be sorted prior further processing.

@greedy
Copy link

greedy commented Jul 14, 2021

I ran into this problem too and filed #8 without checking for an existing issue first. Anyway, I've actually encountered build failures relating to this when using nix and getting cached binaries built from different hosts as detailed in #8.

@ghost
Copy link

ghost commented Aug 16, 2021

Looks like we are missing a List.sort

@ghost ghost closed this as completed in 5d2f886 Aug 16, 2021
@ghost
Copy link

ghost commented Aug 16, 2021

I pushed a fix to master. If you can confirm that it fully fixes the issue you are observing we'll submit a new release to the opam repo.

@olafhering
Copy link
Author

I came up with this patch a few months ago, which fixed it for me:

--- a/src/shadow/gen/gen.ml
+++ b/src/shadow/gen/gen.ml
@@ -12,7 +12,7 @@ let () =
       failwith "bad command line arguments"
   in
 
-  let files = Sys.readdir dir |> Array.to_list in
+  let files = Sys.readdir dir |> Array.to_list |> List.sort ~cmp:String.compare in
 
   let all_exposed_modules =
     List.filter files ~f:(fun fn -> Filename.check_suffix fn ".cmi")

So yes, thanks for doing commit 5d2f886.

@ghost
Copy link

ghost commented Aug 24, 2021

Alright, new release submitted: ocaml/opam-repository#19314

Bronsa pushed a commit to imandra-ai/ocaml-opam-repository that referenced this issue Oct 28, 2021
This issue 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 a pull request may close this issue.

2 participants