Skip to content

Commit

Permalink
Fix EMLINK on Windows (again) (#7472) (#7475)
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com>
Co-authored-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com>
  • Loading branch information
emillon and nojb authored Apr 4, 2023
1 parent 70ee80e commit 5e72579
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

- Pass correct flags when compiling `stdlib.ml`. (#7241, @emillon)

- 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.post1 (2023-02-21)
------------------------

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 @@ -339,7 +339,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

0 comments on commit 5e72579

Please sign in to comment.