Move resolve-in-sysroot into the shared library
/cc @denittis
Based on !138 (merged) (actually I developed this first, and shuffled !138 (merged) to the beginning after noticing the bugs).
The idea of this branch is to use resolve-in-sysroot from graphics.c, for more-correct resolution of symlinks in the sysroot. That's not implemented yet, but what I do have here seems worth merging already.
Additional commits:
-
Move resolve-in-sysroot module into libsteam-runtime-tools
-
_srt_file_get_contents_in_sysroot: Add
-
Move _srt_file_test_in_sysroot into the library
While I'm there, add the ability to pass in a pre-opened file descriptor.
-
graphics: Canonicalize relative filenames before prepending sysroot
Otherwise we'll treat them as relative to
/
instead of the current working directory, which breaks some of the tests when we move to always using a non-NULL sysroot (that is sometimes/
). -
system-info: Always have a non-NULL sysroot
This simplifies various code paths.
/
is a perfectly good path to the system root. -
system-info: Open sysroot as a file descriptor
-
os: Use pre-opened sysroot fd to read /etc/os-release, etc.
-
resolve-in-sysroot: Add SRT_RESOLVE_FLAGS_DIRECTORY
-
system-info: Resolve container flag-files via sysroot
This is a little more correct if the sysroot contains inconvenient symbolic links.
There's a small behaviour change here: if the sysroot is Flatpak or pressure-vessel but does not actually contain /run/host, we don't return the path to where it ought to have been.