fix(steam-x64): skip empty runtime library folders when linking (#2334)

This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-11-11 20:55:45 -05:00
1 parent a7bd6ed299
commit 8e02be2440
2 files changed
+73 -1

No files matched your search

@@ -449,7 +449,11 @@ mkdir -p "$srt_libs"
for d in "$STEAM_X64"/steamrt64/pv-runtime/steam-runtime-steamrt/steamrt3c_platform_*/files/lib/x86_64-linux-gnu \
"$STEAM_X64"/steamrt64/pv-runtime/steam-runtime-steamrt/steamrt3c_platform_*/files/usr/lib/x86_64-linux-gnu; do
[ -d "$d" ] || continue
for f in "$d"/*.so*; do [ -e "$srt_libs/$(basename "$f")" ] || ln -s "$f" "$srt_libs/"; done
for f in "$d"/*.so*; do
[ -e "$f" ] || [ -L "$f" ] || continue
s="$srt_libs/$(basename "$f")"
{ [ -e "$s" ] || [ -L "$s" ]; } || ln -s "$f" "$srt_libs/"
done
done
FEX_ROOTFS=$ROOTFS /usr/local/bin/FEX "$ROOTFS/usr/sbin/ldconfig.real" -n "$srt_libs" >>"$LOG" 2>&1 || step "ldconfig on $srt_libs failed"
sniper_compat=$X64_HOME/sniper-compat
@@ -458,6 +462,7 @@ mkdir -p "$sniper_compat"
hb=$(ls "$srt_libs"/libharfbuzz.so.0.* 2>/dev/null | head -n 1)
if [ -n "$hb" ]; then ln -s "$hb" "$sniper_compat/libharfbuzz.so.0"; else step "warning: no HarfBuzz in Valve's runtime for the newer-runtime titles"; fi
for f in "$srt_libs"/*; do
[ -e "$f" ] || [ -L "$f" ] || continue
n=$(basename "$f")
if [ -e "$ROOTFS/usr/lib/x86_64-linux-gnu/$n" ] || [ -e "$ROOTFS/lib/x86_64-linux-gnu/$n" ]; then rm -f "$f"; fi
done
@@ -0,0 +1,67 @@
import os
from pathlib import Path
import re
import subprocess
import tempfile
import unittest
SCRIPT = Path(__file__).resolve().parents[1] / 'linuxfs/overlay/usr/local/bin/droiddeck-steam-x64'
SOURCE = SCRIPT.read_text()
LIBRARY_LOOP = re.search(r'^for d in "\$STEAM_X64"/steamrt64/.*?^done\nFEX_ROOTFS=', SOURCE, re.M | re.S).group()
LIBRARY_LOOP = LIBRARY_LOOP[:LIBRARY_LOOP.rfind('\nFEX_ROOTFS=')]
class SteamX64RuntimeLibsTest(unittest.TestCase):
def setUp(self):
self.temp = tempfile.TemporaryDirectory()
self.addCleanup(self.temp.cleanup)
self.root = Path(self.temp.name)
self.steam = self.root / 'Steam'
self.runtime = self.steam / 'steamrt64/pv-runtime/steam-runtime-steamrt'
self.lib = self.runtime / 'steamrt3c_platform_a/files/lib/x86_64-linux-gnu'
self.usr_lib = self.runtime / 'steamrt3c_platform_a/files/usr/lib/x86_64-linux-gnu'
self.lib.mkdir(parents=True)
self.usr_lib.mkdir(parents=True)
self.dest = self.root / 'steamrt-libs'
self.dest.mkdir()
def run_loop(self):
shell = 'srt_libs="$DEST"\n' + LIBRARY_LOOP
env = dict(os.environ, STEAM_X64=str(self.steam), DEST=str(self.dest))
return subprocess.run(['bash', '-eu', '-c', shell], env=env, capture_output=True, text=True, timeout=10)
def test_empty_library_directory_is_skipped(self):
(self.usr_lib / 'libexample.so.1').touch()
result = self.run_loop()
self.assertEqual(0, result.returncode, result.stderr)
self.assertTrue((self.dest / 'libexample.so.1').is_symlink())
def test_two_platform_versions_with_empty_lib_dirs_use_usr_lib(self):
platform_b = self.runtime / 'steamrt3c_platform_b'
(platform_b / 'files/lib/x86_64-linux-gnu').mkdir(parents=True)
usr_lib_b = platform_b / 'files/usr/lib/x86_64-linux-gnu'
usr_lib_b.mkdir(parents=True)
(self.usr_lib / 'libexample.so.1').touch()
(usr_lib_b / 'libother.so.1').touch()
result = self.run_loop()
self.assertEqual(0, result.returncode, result.stderr)
self.assertTrue((self.dest / 'libexample.so.1').is_symlink())
self.assertTrue((self.dest / 'libother.so.1').is_symlink())
def test_stale_literal_glob_link_does_not_abort(self):
(self.dest / '*.so*').symlink_to('/missing/*.so*')
result = self.run_loop()
self.assertEqual(0, result.returncode, result.stderr)
self.assertTrue((self.dest / '*.so*').is_symlink())
def test_existing_dangling_library_link_is_not_recreated(self):
(self.lib / 'libexample.so.1').touch()
(self.dest / 'libexample.so.1').symlink_to('/missing/libexample.so.1')
result = self.run_loop()
self.assertEqual(0, result.returncode, result.stderr)
self.assertEqual('/missing/libexample.so.1', os.readlink(self.dest / 'libexample.so.1'))
if __name__ == '__main__':
unittest.main()