make_game: a folder whose name the locale cannot decode no longer stops --pick on Linux (MAKE-GAME-PICK-FSDECODE) #1347
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1347"
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?
Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-24T22:07:08Z.
On Linux and the BSDs,
--pickopens the desktop's folder dialog through kdialog or zenity (native_ask,make_game.py). Its answer was read withsubprocess.run(..., text=True), so choosing a folder whose name is not valid in the locale's encoding (e.g. bytesb"/tmp/caf\xe9"under a UTF-8 locale) raisedUnicodeDecodeError, whichpick_gamedoes not catch (it only expectsOSErrorfrom the tool), and the build stopped with a traceback.What changes:
native_askreads the answer as bytes and decodes it withos.fsdecode, so the path round-trips (os.fsencodegives back the bytes the dialog printed). Return codes keep their meaning (1 = cancelled, other non-zero =OSError).print()ing such a str on a UTF-8 terminal raisesUnicodeEncodeError, so the twochose ... in <folder>log lines go through a newshow_path()that shows the undecodable bytes escaped (/tmp/caf\xe9). Display only: the path handed to the build is unchanged.tests/test_make_game_pick_fsdecode.py(CPU only, no display, no game files): a stand-in kdialog printing raw bytes,show_pathagainst a strict UTF-8 stream, andpick_gameend to end with a mocked dialog. Windows is skipped (the native dialogs never run there); the stand-in test skips itself when the temp folder is mountednoexec.Tested on Linux arm64, no network, Python 3.12,
python3 -I:main4a50cafc:FAILED (errors=5), includingUnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9innative_ask.Ran 5 tests ... OK(with an executableTMPDIR);tests/test_make_game_pick.pyOK;make_game.py --helpOK;scripts/check_no_game_data.pyclean on both files.Takes the finding posted by Snooozs in #14 (read in the code there, reproduced here).
AI-assisted (Claude Code and Mistral Vibe).
Claimed in the coordination issue as: MAKE-GAME-PICK-FSDECODE
🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-24T23:40:09Z.
Verified on Windows host (AI-assisted review).
python -I tests/test_make_game_pick_fsdecode.py: 5 tests, 3 skipped (they target kdialog/zenity, which never run on Windows), 2 pass — the non-dialog show_path() unit tests.python -I -m compileall make_game.pyclean;python -I make_game.py --helpprints usage;tests/test_text_write_line_endings.pystill passes.Verdict: looks correct, no Windows regressions found. The real verification needs a Linux CI run for the 3 skipped tests.
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T22:29:12Z.
Native Windows 11 Verification (
82d0dfcc40)Verified
82d0dfcc40f5af0a72cc99d247c9fa707284bae6merged cleanly ontoorigin/main(adfb3821a23612263c1c5b195453ed01c4c114db,git merge-tree --write-treerc=0) on native Windows 11 (26200):origin/mainadfb3821a):python -I tests/test_make_game_pick_fsdecode.pyfailed (FAILED (errors=2, skipped=3)).origin/main + 82d0dfcc40):python -I tests/test_make_game_pick_fsdecode.pypassed (5 ran, OK (skipped=3)— confirmingShowPathTestescapes lone surrogates cleanly on Windows undersurrogatepasswithout raisingUnicodeEncodeErroron strict UTF-8 streams, while skipping the Linuxkdialog/zenitydialog tests cleanly onos.name == "nt").AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T00:17:34Z.
Tested
82d0dfcc4merged (no commit) withmain829530dbd: Python 3.12.4, Windows 11 10.0.26300, CPU only.check_no_game_data.pyis clean.tests/test_make_game_pick_fsdecode.py, 5 tests pass (3 skipped).make_game.pyback tomain, 2 errors (module 'make_game' has no attribute 'show_path').No blocker from my side.
AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T00:45:41Z.
Merged after TheGeogeo's red/green check (check) (Windows, Python tests, no GPU needed) and a local re-check here. Merged after local re-verification: this PR merged onto
main6d004cc68without conflict, and its test file(s) (tests/test_make_game_pick_fsdecode.py) pass there. Earlier today the same tests failed onmainwithout the PR (red/green) and a bundle with other open PRs showed no new failures.check_no_game_data.pyis clean. Windows 11, Python 3.14; no GPU needed for these tests.AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.