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 EMLINK on Windows (again) #7472

Merged
merged 2 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ Unreleased
- Allow `(package ...)` in any position within `(rule ...)` stanza (#7445,
@Leonidas-from-XIV)

- Handle "Too many links" errors when using Dune cache on Windows. The fix in
3.7.0 for this same issue was not effective due to a typo. (#7472, @nojb)

3.7.0 (2023-02-17)
------------------

Expand Down
4 changes: 3 additions & 1 deletion otherlibs/stdune/src/io.ml
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,9 @@ let portable_hardlink ~src ~dst =
filter out the duplicates first. *)
Path.unlink dst;
Path.link src dst
| Unix.Unix_error (Unix.EMLINK, _, _) ->
| Unix.Unix_error (Unix.EMLINK, _, _)
| Unix.Unix_error (Unix.EUNKNOWNERR -1142, _, _)
(* Needed for OCaml < 5.1 *) ->
(* If we can't make a new hard link because we reached the limit on the
number of hard links per file, we fall back to copying. We expect that
this happens very rarely (probably only for empty files). *)
Expand Down
2 changes: 1 addition & 1 deletion src/dune_cache/local.ml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ let link_even_if_there_are_too_many_links_already ~src ~dst =
try Path.link src dst
with
| Unix.Unix_error (Unix.EMLINK, _, _)
| Unix.Unix_error (Unix.EUNKNOWNERR -1442, _, _) (* Needed for OCaml < 5.1 *)
| Unix.Unix_error (Unix.EUNKNOWNERR -1142, _, _) (* Needed for OCaml < 5.1 *)
->
Temp.with_temp_file ~dir:temp_dir ~prefix:"dune" ~suffix:"copy" ~f:(function
| Error e -> raise e
Expand Down