run_game_wine.sh: harden inner args, PCI matching, bash wrapper, and summary exit #2332
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2332
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/run-game-wine-safety"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Claimed in the coordination issue as: RUN-GAME-WINE-UPPERCASE-DEVICE-INNER-BASH-AND-SUMMARY-EXIT (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7193935612)
What and why
--innermode inscripts/run_game_wine.sh: require all 5 internal arguments (exit 2), safely resolveWINESERVERwhenWINEhas no adjacent executable, avoid unbound variable errors onWINEDLLOVERRIDES, andwaiton stopped background screenshot/watchdog jobs (using aTERM/INT-trapped background sleep for$WATCHso watchdog sleeps never linger).--screenshot-everyvalues (00,05) and nonexistent--buildpaths upfront (exit 2), and ensure the--lockparent directory exists (mkdir -p) before opening the lock descriptor.--devicePCI IDs case-insensitively against/sys/class/drm(orLEONIDA_DRM_SYSFS_DIR) while keepingMESA_VK_DEVICE_SELECT="$DEVICE!"unchanged.#!/usr/bin/env bashin the generated$RUN/inner.shwrapper so Bash$'...'quoting works cleanly even when/bin/shisdash.tools/game_run_summary.py(PIPESTATUS[0]) instead of returningtee's exit status.tests/test_run_game_wine_safety.py.Tested
python -I tests/test_run_game_wine_safety.py -v(via Git Bash): 3 passed, 0 failed (detachedupstream/mainbaseline with only the new test file fails with 2 failures). Note:tests/test_run_game_wine.pyis POSIX-only (import fcntl) and was not run natively on Windows.python -I tests/test_ci_registration.py: 16 passed.python -I tests/test_text_write_line_endings.py: 3 passed.python -I scripts/check_no_game_data.py,python -I -m compileall -q tests/test_run_game_wine_safety.py,git ls-files -s scripts/run_game_wine.sh(100755), andgit diff --cached --check: passed.GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.#2332 | head f017b43f9d4b45cbaf57554a82225032a4e0d536 (merged cleanly with main 09c153948) |
python -I tests/test_run_game_wine_safety.py| red on main:FAILED (failures=2)(2 != 0on nested--lockparent directory creation and1 != 2on--inner/--screenshot-every/ missing--buildvalidation) | green on PR+main:3 tests OK(-k test_uppercase_device_inner_bash_lock_parent_and_summary_exit_propagation:1 test OK) | Windows 11, Python 3.12.10 (Git Bash) | AI-assisted: yesAudited
scripts/run_game_wine.shandtests/test_run_game_wine_safety.py(--innerarg-count guard, leading-zero--screenshot-everyrejection,--buildexistence check,mkdir -pfor--lockparent, case-insensitive PCIVID:DIDsysfs matching,#!/usr/bin/env bashinner wrapper, watchdog cleanup, and${PIPESTATUS[0]}summary exit propagation). Also passedtests/test_ci_registration.py(18 OK),tests/test_text_write_line_endings.py(3 OK),tests/test_runner_calls_all_tests.py(3 OK), andscripts/check_no_game_data.pyon the merged tree.On macOS the new test fails:
tests/test_run_game_wine_safety.py->FAILED (failures=1), 3/3 runs (MEASURED; Apple M3, macOS 26.5.1, headf017b43f9merged ontomain6a1da58aa):The cause is
${DEVICE,,}and${ven,,}:${did,,}(scripts/run_game_wine.sh:231and:237): lowercase expansion is bash 4+, and macOS's/bin/bash, which#!/usr/bin/env bashfinds there, is 3.2, soKWIN_DRM_DEVICESis never set. Themacos-pythonjob will show it oncemain's own failures are gone; its current run stops at an earlier file.A bash 3.2 form makes the test pass here, 3/3 runs (MEASURED):
I have not run the script itself on Linux with this change, only the test on macOS.
Not checked by a second agent or human yet.
AI-assisted (Claude Code).
Red/green: tests/test_run_game_wine_safety.py fails 2 assertions on main (run_game_wine.sh accepts bad --inner and numeric args) and passes with the PR (cloud run on main 7daa4a4).
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main 7daa4a4a5 in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)