Skip to content

Use SrtSysroot in pv-runtime

Simon McVittie requested to merge wip/smcv/pv-runtime-sysroot into main

This sets us up to use SrtSysroot more consistently (for slightly better handling of --graphics-provider=/ and slightly more concise code).

It also allows _srt_file_test_in_sysroot() to be replaced by the considerably shorter _srt_sysroot_test() that was introduced in !612 (merged), similar to the way !612 (merged) already replaced _srt_file_get_contents_in_sysroot() with _srt_sysroot_load().

/cc @denittis


  • pv-runtime: Use a SrtSysroot for the provider in the current namespace

    We need to be a bit careful here, because we can only interpret dynamic string tokens like ${LIB} if we're using the real root, which we previously represented as path / but now represent with _srt_sysroot_new_direct().

  • pv-wrap: Use a SrtSysroot to represent the interpreter root

    This is only for consistency, and no functional change is intended: we know that the interpreter root is constructed as a fdio-based object.

  • pv-runtime: Use a SrtSysroot object for the host root

  • pv-runtime: Use a SrtSysroot object for the mutable sysroot

  • pv-runtime: Use _srt_sysroot_open to open libraries in sysroot

    Just for consistency: we know that self->provider->in_current_ns is fdio-based.

  • sysroot: Add support for requiring the file to be executable

    This is necessary for a full replacement for _srt_file_test_in_sysroot().

  • tests: Test SRT_RESOLVE_FLAGS_MUST_BE_EXECUTABLE

  • pv-graphics-provider: Use _srt_sysroot_test

  • pv-runtime: Use SrtSysroot to locate files taken from host

    No functional change: self->host_root is never using direct I/O anyway.

  • pv-runtime: Use SrtSysroot to resolve /etc/amd, etc. in provider

    This means that if the provider is the current execution environment, we will use path-based rather than fd-based I/O. That should not have any practical effect, because when we're running under FEX-Emu, the graphics provider defaults to the FEX rootfs anyway, and when we are not being emulated, there's no practical difference between path-based and fd-based I/O; but it could matter for non-FEX emulators, and will make explicit --graphics-provider=/ work better under FEX.

  • pv-runtime: Use SrtSysroot to resolve /etc/localtime in host

    No functional change, because self->host_root is always fd-based I/O anyway.

  • pv-runtime: Use SrtSysroot to resolve remaining files in provider

    As with earlier commits, this will usually have no practical effect, but it will make explicit --graphics-provider=/ more likely to work under FEX-Emu.

  • pv-runtime: Use SrtSysroot to resolve in mutable sysroot where possible

    No functional change, the mutable sysroot is always accessed via fd-based I/O anyway; but the resulting code is a bit shorter.

    Several direct uses of _srt_resolve_in_sysroot() remain, because they use SRT_RESOLVE_FLAGS_MKDIR_P, but that's fine.

  • pv-runtime: Don't try to delete members of a non-directory

    If the libdir isn't a directory, then we certainly don't need to (and can't) delete its contents.

  • Remove _srt_file_test_in_sysroot, which is now unused

    Convert its test coverage into test coverage for _srt_sysroot_test(), rather than wasting it.

Edited by Simon McVittie

Merge request reports