tools: print the plain path, not a repr'd one, in OSError messages (OLD-9861) #1792

Open
github-bot wants to merge 1 commit from github-bot/gh-1792 into main AGit
Owner

@⁠Ch1mpleo on GitHub · 2026-11-25 12:13 UTC · original
Ch1mpleo:carry/old-9861 → main · +12 −3 · 3 files · 1 commits · open

Claimed in the coordination issue as: OLD-9861 (#1608)

What and why

Carries forward old-pr/9861 (draft #128, preserving Salim Hammami's original commit) rebased onto current main. Prints the plain path instead of a
epr'd path in OSError messages in ools/bink_names.py, ools/opus_tags.py, and ools/world_names.py.

Tested

  • python -m compileall -q tools/bink_names.py tools/opus_tags.py tools/world_names.py — exit 0.
  • python -I tests/test_bink_names.py — 36 tests, OK.
  • python -I tests/test_opus_tags.py — 28 tests, OK.
  • python -I tests/test_world_names.py — 31 tests, OK.
  • python -I scripts/check_no_game_data.py tools/bink_names.py tools/opus_tags.py tools/world_names.py — exit 0.

GPUs tested: n/a (CPU-only Python tools & unit tests, Windows 11 x64, Python 3.14.7)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled
    eeds rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a — no translator change)
**@⁠Ch1mpleo** on GitHub · 2026-11-25 12:13 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1792) `Ch1mpleo:carry/old-9861` → `main` · +12 −3 · 3 files · 1 commits · open Claimed in the coordination issue as: OLD-9861 (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why Carries forward old-pr/9861 (draft #128, preserving Salim Hammami's original commit) rebased onto current main. Prints the plain path instead of a epr'd path in OSError messages in ools/bink_names.py, ools/opus_tags.py, and ools/world_names.py. ### Tested - python -m compileall -q tools/bink_names.py tools/opus_tags.py tools/world_names.py — exit 0. - python -I tests/test_bink_names.py — 36 tests, OK. - python -I tests/test_opus_tags.py — 28 tests, OK. - python -I tests/test_world_names.py — 31 tests, OK. - python -I scripts/check_no_game_data.py tools/bink_names.py tools/opus_tags.py tools/world_names.py — exit 0. GPUs tested: n/a (CPU-only Python tools & unit tests, Windows 11 x64, Python 3.14.7) AI-assisted: yes ### Checklist - [x] Based on current main and merges cleanly (a conflicting pull request is labeled eeds rebase). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a — no translator change)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:05:31 +00:00
Author
Owner

@⁠madvillain91 on GitHub · 2026-11-25 13:18 UTC · original · reviewed

Independent Windows 11 26H2 (26300.9711) check at 4811fd104 against main 98c2f7777 (PR base 0d80bc5df), using CPython 3.12.3 (python -I) and Git for Windows 2.56.0.windows.2. Existing suites pass (test_bink_names.py 36/36 in 0.685s, test_opus_tags.py 28/28 in 5.948s, test_world_names.py 31/31 in 0.489s), but a few issues stand out:

  1. In tools/bink_names.py:459, a.mount is a list[str] (action="append"). When error.filename is None, {error.filename or a.mount} prints a repr'd Python list with doubled backslashes on Windows -- reproduced locally as:
    bink_names: error: ['C:\\Users\\...\\m.xml']: Permission denied
    Joining ", ".join(a.mount) or omitting the path when error.filename is None (matching world_names.py) would avoid that.
  2. Other OSError handlers in the same main() functions still interpolate raw {error} / {e}: tools/bink_names.py lines 464 (load_streams), 469 (load_pins), and 483 (write), plus tools/opus_tags.py line 273 (load_names/load_dialogue).
  3. No regression tests were added asserting plain-path formatting on OSError.
**@⁠madvillain91** on GitHub · 2026-11-25 13:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1792#pullrequestreview-6058332926) · **reviewed** Independent Windows 11 26H2 (26300.9711) check at 4811fd104 against main 98c2f7777 (PR base 0d80bc5df), using CPython 3.12.3 (python -I) and Git for Windows 2.56.0.windows.2. Existing suites pass (test_bink_names.py 36/36 in 0.685s, test_opus_tags.py 28/28 in 5.948s, test_world_names.py 31/31 in 0.489s), but a few issues stand out: 1. In tools/bink_names.py:459, `a.mount` is a `list[str]` (`action="append"`). When `error.filename` is `None`, `{error.filename or a.mount}` prints a repr'd Python list with doubled backslashes on Windows -- reproduced locally as: `bink_names: error: ['C:\\Users\\...\\m.xml']: Permission denied` Joining `", ".join(a.mount)` or omitting the path when `error.filename` is `None` (matching world_names.py) would avoid that. 2. Other OSError handlers in the same `main()` functions still interpolate raw `{error}` / `{e}`: `tools/bink_names.py` lines 464 (`load_streams`), 469 (`load_pins`), and 483 (`write`), plus `tools/opus_tags.py` line 273 (`load_names`/`load_dialogue`). 3. No regression tests were added asserting plain-path formatting on OSError.
Author
Owner

@⁠Ch1mpleo on GitHub · 2026-11-25 16:33 UTC · original

Thanks for the thorough review @⁠madvillain91! Pushed a follow-up commit (\903f45020) addressing all three points (keeping Salim Hammami's original commit intact):

  1. \ ools/bink_names.py: joined \.mount\ with ", ".join(a.mount)\ when \rror.filename\ is \None\ so it never prints a
    epr'd Python list.
  2. \ ools/bink_names.py\ and \ ools/opus_tags.py: updated the remaining \OSError\ handlers in \main()\ (\load_streams, \load_pins, \write, and \load_names/\load_dialogue) to format plain paths (\rror.filename\ / \strerror).
  3. Added \ est_oserror_prints_plain_path_without_repr\ regression tests in \ ests/test_bink_names.py\ (37/37 OK), \ ests/test_opus_tags.py\ (29/29 OK), and \ ests/test_world_names.py\ (32/32 OK).
**@⁠Ch1mpleo** on GitHub · 2026-11-25 16:33 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1792#issuecomment-7168164998) Thanks for the thorough review @⁠madvillain91! Pushed a follow-up commit (\903f45020\) addressing all three points (keeping Salim Hammami's original commit intact): 1. \ ools/bink_names.py\: joined \.mount\ with \", ".join(a.mount)\ when \rror.filename\ is \None\ so it never prints a \ epr\'d Python list. 2. \ ools/bink_names.py\ and \ ools/opus_tags.py\: updated the remaining \OSError\ handlers in \main()\ (\load_streams\, \load_pins\, \write\, and \load_names\/\load_dialogue\) to format plain paths (\rror.filename\ / \strerror\). 3. Added \ est_oserror_prints_plain_path_without_repr\ regression tests in \ ests/test_bink_names.py\ (37/37 OK), \ ests/test_opus_tags.py\ (29/29 OK), and \ ests/test_world_names.py\ (32/32 OK).
Author
Owner

@⁠OguzSoykan on GitHub · 2026-11-25 20:14 UTC · original

Verified on native Windows at head 4811fd104: test_bink_names.py, test_opus_tags.py and test_world_names.py fail on main and pass here. Same change area as #128 (tool side) and the opposite direction from #1425 (test side).

Native Windows 10 Pro 19045, CPython 3.12, py -3.12 -I, checkout under a non-ASCII profile path (C:\Users\Oğuz\..., TEMP is the 8.3 alias C:\Users\OUZ~1\...). No game files.

AI-assisted (Claude Code).

**@⁠OguzSoykan** on GitHub · 2026-11-25 20:14 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1792#issuecomment-7173380611) Verified on native Windows at head `4811fd104`: `test_bink_names.py`, `test_opus_tags.py` and `test_world_names.py` fail on `main` and pass here. Same change area as #128 (tool side) and the opposite direction from #1425 (test side). Native Windows 10 Pro 19045, CPython 3.12, `py -3.12 -I`, checkout under a non-ASCII profile path (`C:\Users\Oğuz\...`, TEMP is the 8.3 alias `C:\Users\OUZ~1\...`). No game files. AI-assisted (Claude Code).
Author
Owner

@⁠wavehs on GitHub · 2026-11-26 18:45 UTC · original

Verified on main f107ae044 (macOS 27.2.1 arm64, Python 3.15.2). The diff applies cleanly. Reproducing the Windows failure on POSIX by pointing TMPDIR at a folder whose name contains a backslash (legal on POSIX; the tools then repr a filename with a doubled separator, exactly as a Windows path does):

Before (unmodified main): one failure per file — test_bink_names.py::test_unreadable_mount_directory_preserves_the_report, test_opus_tags.py::test_cli_reports_incomplete_directory_discovery, test_world_names.py::test_an_unreadable_subtree_does_not_replace_the_dictionary — each assertIn(blocked, stderr) against a ...back\\\\slash... line.

After: all three OK (Ran 36, Ran 28, Ran 31 tests).

Two coordination notes:

  • This is functionally identical to #128, which is a draft carrying the same old old-pr/9861 commit (only blob hashes/line offsets differ). As the non-draft, rebased-on-current-main copy that claims OLD-9861, this is the one that should land; #128 can close afterwards.
  • It is mutually exclusive with #1425 (the test-side change that asserts repr(blocked)). If #1425 lands first, these three tests must be changed back for this PR; the product-side message is the better outcome, so I would land this one and close #1425.

AI-assisted (verification only).

**@⁠wavehs** on GitHub · 2026-11-26 18:45 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1792#issuecomment-7200812185) Verified on `main` `f107ae044` (macOS 27.2.1 arm64, Python 3.15.2). The diff applies cleanly. Reproducing the Windows failure on POSIX by pointing `TMPDIR` at a folder whose name contains a backslash (legal on POSIX; the tools then repr a filename with a doubled separator, exactly as a Windows path does): **Before** (unmodified main): one failure per file — `test_bink_names.py::test_unreadable_mount_directory_preserves_the_report`, `test_opus_tags.py::test_cli_reports_incomplete_directory_discovery`, `test_world_names.py::test_an_unreadable_subtree_does_not_replace_the_dictionary` — each `assertIn(blocked, stderr)` against a `...back\\\\slash...` line. **After**: all three `OK` (`Ran 36`, `Ran 28`, `Ran 31` tests). Two coordination notes: - This is functionally identical to **#128**, which is a draft carrying the same old `old-pr/9861` commit (only blob hashes/line offsets differ). As the non-draft, rebased-on-current-main copy that claims OLD-9861, this is the one that should land; #128 can close afterwards. - It is **mutually exclusive with #1425** (the test-side change that asserts `repr(blocked)`). If #1425 lands first, these three tests must be changed back for this PR; the product-side message is the better outcome, so I would land this one and close #1425. AI-assisted (verification only).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1792/head:github-bot/gh-1792'
git switch 'github-bot/gh-1792'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1792'
git switch 'github-bot/gh-1792'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1792'
git switch 'github-bot/gh-1792'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1792'
git switch 'main'
git merge --squash 'github-bot/gh-1792'
git switch 'main'
git merge --ff-only 'github-bot/gh-1792'
git switch 'main'
git merge 'github-bot/gh-1792'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.