Thomas Leonard's work notes

(see roscidus.com for my main blog)

(Eio 1.4)

The main thing this time is that Eio 1.4 is now released!

Eio

I split off the networking part of Anil's PR using new uring features, to make reviewing it easier, then merged both with only minor changes:

  • eio_linux: add Low_level.{socket,bind,listen} with uring support #884.
  • Add ftruncate/fdatasync #850.

eio_linux.ml was getting rather huge and hard to navigate so I split it up:

  • eio_linux: split out net.ml, process.ml, fs.ml and time.ml #886.

The Eio code was disabling unstable alerts in many places and I couldn't remember why - building without them worked even on old compiler versions! It turned out they were a work-around for an old Merlin bug!

  • Remove all use of [@@@alert "-unstable"] #885.

There's some inconsistency in the Eio code about which functions raise the plain Unix.Unix_error and which use the richer Eio.Io. As a first step to fixing this, I combined the wrapping functions and moved them to Eio_unix:

  • Add Eio_unix.Err module #887.

Using that, I was able to move the extended socket options code from Eio_linux to Eio_unix, allowing it to work with Eio_posix (which can also be used on Linux), and allowing some of the options to work on other platforms too:

  • Move sockopt stubs to eio.unix #889.
  • Support TCP_KEEPIDLE on macos #890.

This is enough to allow removing the custom socket options C stubs from capnp-rpc:

  • Use Eio 1.4 for new socket options #321.

Reviewed Anil's PR to work around some problems in macOS's poll (a 2006 Apple post says "hopefully it can be sorted in Leopard because it's an ongoing headache"):

  • eio_posix: fall back to select() for FDs that poll() fails with POLLNVAL #893.

Using -D_DARWIN_UNLIMITED_SELECT means this still works for FDs above 1023.

Extended Anil's PR adding a Flow.null sink so that it's also a null source:

  • Add null sink that consumes/discards all data written to it until eof #894.

Some other minor clean-ups:

  • Remove unused show_backend_exceptions flag #880.
  • Make eio_unix_fork_error call _exit automatically #896.
  • eio_linux: fix chmod test on Ubuntu 22.04 #903.

Minor PR reviews:

  • win32: declare unixsupport functions as CAMLextern #881.
  • fork_action: reject ids that don't fit uid_t/gid_t/pid_t #895.
  • eio_linux: don't return an empty getdents batch before end-of-file #897.

Updating the changelog for the release took a while - there are a lot of changes!

  • Update changelog and documentation #892.

Then trying out the new features in the list revealed some minor UI problems that needed to be fixed:

  • eio_linux: better error when trying to chmod a symlink #901.
  • Net.getaddrinfo: include the query in error messages #900.

I also found that the Pty support was a bit harder to use than expected because Linux returns an error instead of end-of-file when the client-side is closed. I spent some time investigating how that's supposed to work, but decided not to hold up the release for it:

  • Pty raises IO error on Linux #902.

Then the release, plus a couple of updates for down-stream packages:

  • Release Eio 1.4 #30318.
  • cohttp-eio: update tests for new Eio 1.4 getaddrinfo exception #1142.
  • eio-ssl: add {get,set}sockopt functions for Eio 1.4 #26.

Uring

I also investigated an AI-found potential bug in uring (though it turned out to be a false positive):

  • Double free in case of error #160