From 29f711985d82da0cc23cc756e8dedf1d47a83d0e Mon Sep 17 00:00:00 2001 From: Etienne Millon Date: Wed, 30 May 2018 13:57:23 +0200 Subject: [PATCH] Make "path already scanned" message deterministic (#820) When a symlink loop is detected, the following message is printed: > Path X has already been scanned. Cannot scan it again through symlink Y However, the actual symlink that is displayed depends on the order in with `readdir` outputs the contents (which depends on FS internals). This sorts the directory list so that the message is deterministic. It can be tested by adding for example a `List.rev` call after `Path.readdir`: the affected version will return a different version in the `github764` test. Signed-off-by: Etienne Millon --- src/file_tree.ml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/file_tree.ml b/src/file_tree.ml index e04827f4..8d120783 100644 --- a/src/file_tree.ml +++ b/src/file_tree.ml @@ -199,6 +199,11 @@ let load ?(extra_ignored_subtrees=Path.Set.empty) path = Left fn) in let files = String.Set.of_list files in + let sub_dirs = + List.sort + ~compare:(fun (a, _, _) (b, _, _) -> String.compare a b) + sub_dirs + in let project = match Dune_project.load ~dir:path ~files with | Some _ as x -> x