mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:35:53 +01:00
[PR #1347] make_game: a folder whose name the locale cannot decode no longer stops --pick on Linux (MAKE-GAME-PICK-FSDECODE) #1377
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1377
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1347
Author: @PierreEbele
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:make-game-pick-fsdecode📝 Commits (1)
82d0dfcmake_game: a folder chosen in kdialog/zenity whose name is not valid in the locale encoding no longer stops --pick (MAKE-GAME-PICK-FSDECODE)📊 Changes
2 files changed (+103 additions, -4 deletions)
View changed files
📝
make_game.py(+17 -4)➕
tests/test_make_game_pick_fsdecode.py(+86 -0)📄 Description
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
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.