Changes for v2:
Drop use of g_canonicalize_filename.
While Daniel pointed out how to add stuff to glib-compat.h,
full canonicalization is overkill for path() in any case.
I also discovered that I'd been testing w/ glib 2.56 and so
hadn't been testing the g_canonicalize_filename case anyway.
Cover from v1:
This is a third variant attempting to fix the problem of
the -L interp_prefix handling not coping well pointing to
a full chroot.
Previous versions include:
https://lists.gnu.org/archive/html/qemu-devel/2018-05/msg06592.html
https://lists.gnu.org/archive/html/qemu-devel/2018-05/msg07304.html
Both of the other versions keep an open file descriptor to
the directory that is interp_prefix. While this seems to be
efficient, they also leak a file descriptor into the guest.
This has follow-on effects on the emulation, causing failures
e.g. within the LTP testsuite.
This version uses only string manipulation and access(2).
A plausible criticism of this is the mutex and the cache.
Are they really needed? I have no idea. I can imagine
removing that is actually more efficient, not needing a
lock around a shared data structure.
r~
Richard Henderson (1):
util/path: Do not cache all filenames at startup
util/path.c | 201 ++++++++++++----------------------------------------
1 file changed, 47 insertions(+), 154 deletions(-)
--
2.17.1