WIP: wrap: correctly handle bwrap mounting in case-insensitive filesystems

Ludovico de Nittis requested to merge wip/case_insensitive_fs into main

We often tell bubblewrap to mirror a certain directory from outside the container to the inside. When we are in a case insensitive filesystem this operation might fail because bubblewrap reads /proc/self/mountinfo to check if the directory was successfully mounted, but it might happen that the directory is not listed in mountinfo because the kernel has put a different case combination.

To workaround this issue we try to predict which case combination the kernel is going to use (with fd and readlink(2)), and adjust the bind-mount accordingly.

(Resolves: #47 (closed), steam-runtime#326)

Just changing the bind-mount in adjust_exports would not enough because for example if we change the bind of /media/usb1/steam_insensitive/SteamLibrary/SteamApps/compatdata/302380 to /media/usb1/steam_insensitive/SteamLibrary/steamapps/compatdata/302380, but we leave STEAM_COMPAT_DATA_PATH set to the former, then Proton's filelock.py will fail when it tries to acquire a lock from the STEAM_COMPAT_DATA_PATH that has a case combination that is not available in the container.

For this reason I decided to place the check in bind_and_propagate_from_environ(), so that we can adjust both the environment variables and the bind mount paths.

Edited by Ludovico de Nittis

Merge request reports