mirror of
https://github.com/kuhyx/steam-backlog-enforcer.git
synced 2026-11-22 17:22:20 +01:00
The enforcer runs as root under systemd and launches Steam via `sudo -u <user> env DISPLAY=... XAUTHORITY=... DBUS_SESSION_BUS_ADDRESS=...`. sudo uses env_reset, so that list is the child's entire environment - an allowlist where every omission fails silently. XDG_RUNTIME_DIR was missing. Without it Wine cannot reach $XDG_RUNTIME_DIR/pulse/native, falls back from winepulse.drv to winealsa.drv, and hands FMOD raw ALSA devices instead of the session sink. Kingdom Come: Deliverance II died in its Bink startup video as a result. Across 18 sessions the split was total: 9/9 runs logging "PulseAudio Output" exited cleanly, 9/9 logging "HDA NVidia" crashed on the same line. It presented as a corrupt install - the apparent cure was a 92GB reinstall - but verify-integrity always passed. What actually fixed it was the Steam restart the reinstall incidentally performed. Extract the duplicated env construction into _desktop_env.desktop_env_args and derive XDG_RUNTIME_DIR from the target uid, never from the ambient environment: root's own value would point the child at /run/user/0. PULSE_SERVER is deliberately not exported. pressure-vessel reads XDG_RUNTIME_DIR to bind-mount the pulse socket into the Steam Linux Runtime container, whereas a hardcoded unix:/run/user/<uid>/pulse/native names a host path that need not resolve inside it. Also gate the launch on the session existing. The enforcer is ordered only After=network-online, while /run/user/<uid> is created by user-runtime-dir@<uid>.service; on a measured boot the enforcer started 54ms before that unit and won only by doing other work first. Launching in that window would name a runtime dir that is not there and reintroduce the same silent winealsa fallback for the whole session, so defer instead - the enforce loop already retries every 3s, and DesktopSessionNotReadyError subclasses SteamUnavailableError so existing callers degrade as before. An ordering dependency would not be reliable here, since logind may start user-runtime-dir outside the boot transaction. Verified on the failing path rather than a dev shell: after restarting the enforcer, the Steam it launched carried XDG_RUNTIME_DIR=/run/user/1000 and KCD2 ran 15 minutes on "PulseAudio Output" with no crash artifacts. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| conftest.py | ||
| test_actions.py | ||
| test_cmd_done_part2.py | ||
| test_config.py | ||
| test_desktop_env.py | ||
| test_enforce_loop_part2.py | ||
| test_enforce_loop_part3.py | ||
| test_enforce_loop.py | ||
| test_enforcer_part2.py | ||
| test_enforcer.py | ||
| test_game_install_part2.py | ||
| test_game_install_part3.py | ||
| test_game_install.py | ||
| test_hltb_detail.py | ||
| test_hltb_part2.py | ||
| test_hltb_part3.py | ||
| test_hltb_search_part2.py | ||
| test_hltb_search.py | ||
| test_hltb.py | ||
| test_library_hider_part2.py | ||
| test_library_hider.py | ||
| test_main_part2.py | ||
| test_main_part3.py | ||
| test_main_part4.py | ||
| test_main_part5.py | ||
| test_main.py | ||
| test_mcp.py | ||
| test_polls_tracking_part2.py | ||
| test_polls_tracking.py | ||
| test_protondb.py | ||
| test_scanning_part2.py | ||
| test_scanning_part3.py | ||
| test_scanning_part4.py | ||
| test_scanning.py | ||
| test_stats.py | ||
| test_steam_api.py | ||
| test_store_blocker_part2.py | ||
| test_store_blocker.py | ||
| test_total_block.py | ||
| test_update_restart_guard.py | ||
| test_web_dataset.py | ||
| test_web_server.py | ||
| test_whitelist.py | ||