Eio
With the new uring 2.15.1 release out, I wanted to make a new Eio release to use it. There were a few things to update first though...
Thomas Gazagnaire reported that a failed listen on a Unix path deletes the socket of the listener already there:
- Don't remove Unix socket if binding failed #971.
While investigating that, I found a few other problems related to cleaning up Unix-domain sockets and fixed those too:
- Improve cleanup when closing Unix-domain sockets #977.
To simplify that cleanup, I added the ability to run a Switch hook early (not just cancel it):
- Add
Eio.Switch.remove_hook ~run:true#972.
Thomas also noticed some poor error reporting from getnameinfo, which I fixed:
- Wrap
Not_foundexception fromUnix.getnameinfo#980.
Volker Diels-Grabsch had noticed that daemon fibers could sometimes be
cancelled with the fallback Exit exception as the cause, rather than the real one.
The proposed fix was rather verbose and I simplified it to just swapping two lines of code:
Eio.Switch.run: record error before cancelling daemon fibers #978.
Thomas also discovered that Linux has some surprising behaviour with O_NOFOLLOW.
The open(2) man-page says:
O_NOFOLLOW
If the trailing component (i.e., basename) of path is a symbolic link, then the open fails, with the error
ELOOP.
And basename(3) says:
Trailing '/' characters are not counted as part of the pathname.
and gives the example that in /usr/, the basename is usr.
But in fact, open does follow a usr symlink in this case!
Anil made a PR to fix it, which I simplified a bit:
- eio_posix: don't let a trailing slash follow symlinks out of the sandbox #967.
Finally, I wasn't quite happy with the new Eio_unix.System_info API
(which forces doing a bit of extra work at start-up),
so I changed it to allow waiting until it's used:
- Delay collecting
Eio_unix.System_infoinformation #969.
With that, I released Eio 1.7:
Most software was compatible with the new version, but eio-caqti needed a small fix due to an extra optional argument:
- Compatibilty with Eio 1.7 #151.
Then back to reviewing PRs and fixing issues:
-
eio_posix: fix error handling in
connect#981. -
windows: resolve DOS device names in unrestricted paths #995.
-
windows: report oversized command lines as argument list too long #983.
-
windows: report sandbox root mkdir as already existing #984.
-
windows: support symlinks and junctions without sandbox escapes #968.
-
Enable Windows MDX #979.
Uring
Eio 1.7 used the new Uring.Msghdr API, which meant we could get rid of the old one:
- Remove deprecated functions from the API and inline
msg_name#168.
To help test it, I also added a benchmark:
- Benchmark Unix-domain sockets #169.
Anil had made a PR with a lot of hardening fixes.
That prompted me to get ocaml-uring to compile with -Wall (and Anil added that to the build rule):
One of the nice things about using MDX for tests is that you can install a custom printer for any type. The test cstructs are all small and the test data is plain text, so it simplified things to print them as strings:
- Install a better Cstruct printer for the tests #174.
I then split Anil's hardening PR into several smaller ones to make review easier:
-
Reset
msghdrbuffer sizes on everyrecv_msgso aMsghdr.tcan be reused #175. -
Handle failing operations better #170.
-
Clamp I/O lengths to what the SQE's 32-bit field can hold #171.
-
Reject paths containing NUL bytes instead of truncating them #172.
-
Reject more than
iov_maxbuffers before queuing anything #173. -
Zero-initialise the
statxbuffer #180.
Anil also found a simplification for waiting without a time-out
(we were using io_uring_submit_and_wait_timeout with NULL as the timeout,
but that has an unfortunate side-effect of ignoring signals):
Uring.wait: return on a signal received after a submission #179.
Other
While trying to update this blog, I found that dune would no longer build it:
- Project no longer builds: Couldn't solve the package dependency formula #17127.
I also investigated why the new opam-dune-lint release didn't compile; it looks like an error in the release process:
- v0.7 release is wrong #79.