Skip to content

Move path operations to backends - #913

Merged
talex5 merged 1 commit into
ocaml-multicore:mainfrom
talex5:path-ops
Jul 31, 2026
Merged

Move path operations to backends#913
talex5 merged 1 commit into
ocaml-multicore:mainfrom
talex5:path-ops

Conversation

@talex5

@talex5 talex5 commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

This is split off from @avsm's #908 to make reviewing easier. This PR just moves the existing code without changing the logic or adding Windows support or new tests.

Compared to #908:

  • I made PATH implement split and join and all the existing logic moves there. The original PR had some handling of . in the frontend, which seemed odd.
  • DIR now has module Path : PATH, not include PATH, as that seemed a bit cleaner.
  • posix_path.mli now just does include Eio.Fs.Pi.PATH.
  • tests/fs.md just tests Posix_path directly. There doesn't seem any point running a main loop and a backend now that the frontend is just calling the functions directly, and the tests really are checking POSIX syntax, not the host syntax.

@avsm

avsm commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Thanks as always for the review!

I made PATH implement split and join and all the existing logic moves there. The original PR had some handling of . in the frontend, which seemed odd.

This was because I wasn't entirely sure if that was part of the frontend Eio guarantee or not (as #907 was going on). It is cleaner to have them all in the backend as long.

Comment thread lib_eio_linux/fs.ml Outdated
This is to allow Windows paths to behave differently in future (but in
this commit the behaviour is the same as before).

Co-authored-by: Anil Madhavapeddy <anil@recoil.org>
@talex5
talex5 merged commit 6618404 into ocaml-multicore:main Jul 31, 2026
4 of 5 checks passed
@talex5
talex5 deleted the path-ops branch July 31, 2026 10:45
avsm pushed a commit to ocaml/opam-repository that referenced this pull request Aug 20, 2026
CHANGES:

New features:

- Windows paths support (@avsm @kentookura @talex5 @dra27 ocaml-multicore/eio#913 ocaml-multicore/eio#916).
  Previously, an `Eio.Path.t` always used POSIX-style paths, using `/` as the separator,
  but this didn't work well on Windows, especially with absolute paths.

- Pre-connect socket options (@avsm @art-w @talex5 ocaml-multicore/eio#875).
  `Eio.Net.connect` now has `?bind_to` and `?options` arguments for pre-connect configuration.
  Allows an outbound socket to be configured before connect or listen.

- Add `Eio.Path.of_dir` (@talex5 ocaml-multicore/eio#919).
  Just a convenience function.

Bug fixes:

- Fix handling of empty paths when using `fs` unconfined (@talex5 ocaml-multicore/eio#907, reported by @samoht, reviewed by @avsm).

  Some path operations could end up using a path of "" which resulted in an error.
  This was breaking `Path.mkdirs` if only the base directory already existed.

Code cleanups and performance:

- eio_posix: fix build on 32-bit platforms (@talex5 ocaml-multicore/eio#917, reported by @glondu).

- unix: optimise the POSIX path split to allocate much less by scanning (@avsm ocaml-multicore/eio#915, reviewed by @talex5).

- eio_linux: use a bigger stack buffer for `getdents` to speed up bigger dirs (@avsm ocaml-multicore/eio#910).

- Add some more tests for POSIX paths (@avsm @talex5 ocaml-multicore/eio#918).

- Add "available" to opam files (@talex5 ocaml-multicore/eio#921).

- Clean up `dir_path` handling (@talex5 @avsm ocaml-multicore/eio#920).
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 this pull request may close these issues.

2 participants