Skip to content

Commit

Permalink
fix: Stop VCS discovery choking on unreadable root
Browse files Browse the repository at this point in the history
On Android devices, the root directory is not readable. This stops the
VCS discovery failing the whole install by just ignoring that for VCS
discovery, in the same manner as for root.

Signed-off-by: Kovacsics Robert <[email protected]>
  • Loading branch information
KoviRobi authored and rgrinberg committed Dec 2, 2024
1 parent c18b2da commit 52e0f9f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doc/changes/11173.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Warn when failing to discover root due to reads failing. The previous
behavior was to abort. (#KoviRobi, #11173)
11 changes: 10 additions & 1 deletion src/dune_rules/source_tree.ml
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,16 @@ let ancestor_vcs =
|> Vcs.Kind.of_dir_contents
with
| Some kind -> Some { Vcs.kind; root = Path.of_string dir }
| None -> loop dir)
| None -> loop dir
| exception Sys_error msg ->
User_warning.emit
[ Pp.textf
"Unable to read directory %s. Will not look for VCS root in parent \
directories."
dir
; Pp.textf "Reason: %s" msg
];
None)
in
Memo.return (loop (Path.to_absolute_filename Path.root))))
;;
Expand Down

0 comments on commit 52e0f9f

Please sign in to comment.