Respect STEAM_COMPAT_FLAGS=search-cwd
According to https://github.com/ValveSoftware/steam-runtime/issues/301 and https://github.com/ValveSoftware/steam-runtime/issues/317, various games used to rely on the LD_LIBRARY_PATH
Steam Runtime putting an empty entry at the end of the LD_LIBRARY_PATH
(LD_LIBRARY_PATH=...:
), which ld.so
interprets as meaning "... and then try the current working directory".
This looked like a bug rather than something intentional, and is arguably a security vulnerability (because who's to say that the cwd isn't /tmp
, which other users can write into), so we fixed it. However, that made some games regress, because they assumed they could find libraries in the directory from which they are launched. Recent versions of the Steam client address this by doing the equivalent of export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+"${LD_LIBRARY_PATH}:"}$(pwd)"
during game startup.
Mount & Blade: Warband (48700) and Shadowrun Returns (234650) are known examples.
Future versions of the Steam client will also do the equivalent of export STEAM_COMPAT_FLAGS=search-cwd
for games like these. pressure-vessel should use this as a signal that when it runs the actual game (not the installscript, just the actual game, at least for now), it should append the game's working directory to the LD_LIBRARY_PATH
.
In current pressure-vessel, this would look something like:
before:
export LD_LIBRARY_PATH="/overrides/lib/x86_64-linux-gnu:/overrides/lib/i386-linux-gnu"
after:
export LD_LIBRARY_PATH="/overrides/lib/x86_64-linux-gnu:/overrides/lib/i386-linux-gnu:/home/me/.local/share/Steam/steamapps/common/Shadowrun Returns"
(although the part with /overrides
is also likely to change while we refactor pressure-vessel).