WIP: tools: print the plain path, not a repr'd one, in OSError messages #128
Closed
leonida/mandy
Andretuta wants to merge 0 commits from
old-pr/9861 into main
pull from: old-pr/9861
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!128
Loading…
Reference in a new issue
No description provided.
Delete branch "old-pr/9861"
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 closed
This pull request cannot be reopened because the branch was deleted.
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):Resubmission of
#5760(closed during repo transfer/purge at 22:47 UTC). Mergeable with current main with zero conflicts.Claim: https://github.com/ItsNotRexed/Leonida/issues/5581#issuecomment-7100263084
What and why
Tests failed on Windows because the tools put a repr'd path in their error text.
str(OSError)reprs the filename it carries, so every separator doubles on Windows (C:\\Users\\...); on POSIX there is nothing to escape, which is why the tests were green where they were written.The messages now follow the idiom other tools use (
{e.filename or <fallback>}: {e.strerror or e}), printing the path as written.Tests run
Independently tested and verified on
#5760by@Atomic258,@YordiLorenzo,@LuanBogoqb,@cipher-droid.No GPU used, no game data. AI-assisted.
Checked this branch:
tests/test_bink_names.py,tests/test_opus_tags.pyandtests/test_world_names.pyallOKhere. On the Windows runner the same three fail becauseOSError.__str__prints the filename with%rand doubles every backslash; printing the plain path fixes the assertions as they stand, which is the better side to fix than the tests (I withdrew the test-side version, #69, in favour of this). Mergeable against currentmain.Tested 82bdc54f (cherry-picked onto main 1c93c869) on native Windows 11 Home (build 26300), Python 3.12.10: pass.
On main 1c93c869,
python -I tests/test_bink_names.py,tests/test_opus_tags.pyandtests/test_world_names.pyeach fail one test here, with the doubled backslashes of the repr'd path in the message. With this commit all three files end in OK.python -m compileall -q make_game.py tools tests: exit 0. No game files.Not checked: which of the two approaches discussed on #69 the project prefers; this only confirms that this one clears the three Windows failures.
AI-assisted (Claude Code ran the tests and wrote this comment).
Verified on native Windows, because the effect of this change is Windows-only and the Linux leg of CI cannot see it.
What I ran (Windows 11 x64 10.0.29712, Python 3.13, standard library only, no game files, no GPU):
on this pull request's head
82bdc54ffea152d60f3290ba6a3119bd54661ec2, and on currentmaind7576d56ae2c77564c84ffae724ffe9bdd2e6701.On this head: 36, 25 and 31 tests - all OK.
On
main: each of the three fails with one failure, for the reason @Len1k described in https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7125793012:OSError.__str__renders the filename withrepr(), so on Windows every backslash in the message is doubled and the raw path is no longer in the text. Printingerror.filenameanderror.strerrorputs the plain path back, and the three tests pass unchanged.Two notes for whoever merges this:
checkjob collects every failing file and then fails, so onmainthese three sit in front of everything after them in the standard-library loop.Separately,
tests/test_tool_stdout_encoding.pyis red on currentmainfor an unrelated reason:tools/exe_sha.pyandtools/pr_conflict_label.pyhave nosys.stdout.reconfigure(errors="replace")in their__main__block. This branch predates both tools, so that file is green here. I filed that separately as #605, so the Windows job has four red files onmain, not three.AI-assisted.
Independent check on native Windows 11, Python 3.13, stdlib only, from clean worktrees (no game files, no GPU):
82bdc54f:tests/test_bink_names.py36/36,test_opus_tags.py28/28,test_world_names.py31/31 — all OK.main82a2aabcc (git apply --checkexit 0), and all three files pass there too;python -m compileall -q make_game.py tools testsexits 0.One merge hazard: #763 (and its earlier draft #312) changes the same assertions to expect
repr(blocked). Each side passes alone, but your tools plus #763's tests in one tree give 13 failures on Windows (1 + 11 + 1), while Linux CI stays green either way. Details are in the finding I posted on #14.This is the side I would keep — printing a readable path is better than pinning doubled backslashes into the tests. If you want, I can take over the rebase and the close-out of #763/#312; I am not opening a competing PR.
AI-assisted.
world_names.pycan lose the requested output path whenos.replace(tmp, path)fails. AnOSErrorfrom a two-path operation can carry the destination infilename2, but the new handler prints onlyfilenameandstrerror. The message then identifies the temporary file without identifying the output the user requested.Could the handler print both paths when
filename2is present, with a synthetic failed-replace test?AI-assisted review. I inspected the code; I did not run the project tests.
Clean-Room Audit — PR #128 (
bink_names,opus_tags,world_namesOSError formatting)Clean tool-side fix that formats
{error.filename}: {error.strerror}instead of{error}, eliminatingrepr()path escaping differences between Windows and POSIX while keeping existing test assertions clean.Verified clean diff and clean-room boundaries (0 game data); closed duplicate #763 in favor of this approach.
Verdict: APPROVED
Independent Windows check of this PR, merged onto current
main(507029d1e, merges cleanly; the merge touches onlytools/bink_names.py,tools/opus_tags.py,tools/world_names.py).Windows 11 Pro 26H2 (26300.9457), CPython 3.13.15, no game files:
main507029d1emain+ #128python -I tests/test_world_names.pytest_an_unreadable_subtree_does_not_replace_the_dictionary)python -I tests/test_bink_names.pytest_unreadable_mount_directory_preserves_the_report)python -I tests/test_opus_tags.pytest_cli_reports_incomplete_directory_discovery)These are the three Windows-only failures reported today in the coordination issue (#14, the
PermissionErrorrepr finding): the tools printstr(exc), whose quoted filename doubles the backslashes on Windows, so the assertion on the plain path fails. With this PR's plain-path message all three pass and nothing else in those files changes result.AI-assisted: yes (Claude Code).
Verified on native Windows at head
82bdc54ff:test_bink_names.py,test_opus_tags.pyandtest_world_names.pyfail onmainand pass here. The test-side alternative #1425 also passes; only one direction should land. #1792 touches the same three tools.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 aliasC:\Users\OUZ~1\...). No game files.AI-assisted (Claude Code).
Verified on
mainbd6ba97ab(macOS 27.2.1 arm64, Python 3.15.2). The diff applies cleanly and the three test files pass:test_bink_names,test_opus_tags,test_world_namesallOK.The Windows spelling does not occur naturally on macOS, so I drove each tool's
OSErrorpath with a synthetic backslash filename (OSError(2, "No such file or directory", r"C:\Users\runneradmin\AppData\Local\Temp\x.txt")) and captured stderr.Before (unmodified main):
(quoted path, every separator doubled — exactly what a Windows test cannot match against the plain
str(path).)After:
error.filename or <the argument>also keeps a message when the exception carries no filename, anderror.strerror or errorstill shows something for anOSErrorbuilt without one. Looks right; this is the product-side fix, which is the one to take.AI-assisted (verification only).
A stronger reproduction, on macOS, of the exact Windows failure: point
TMPDIRat a folder whose name contains a backslash and run the three files on unmodifiedmain. The tools print thePermissionErrorfilename through{e}(repr'd, every separator doubled), and the test'sassertIn(str(path), stderr)sees the plain spelling:With this PR applied, the same three files under the same
TMPDIRareOK(Ran 36,Ran 28,Ran 31tests). That is the same assertion the Windowscheckjob makes, so this is the Windows red reproduced independently of a Windows runner.(For anyone reusing the trick:
TMPDIRbackslashes turn CMake-argument tests red too, because CMake unescapes\s; those are not Windows failures. The three files above fail for the repr reason, which is the one this PR fixes.)AI-assisted (verification only).
This draft has a live, rebased duplicate: #1792 (Ch1mpleo, claimed as OLD-9861) carries the same
old-pr/9861change onto current main, non-draft and with the three files' tests run. I applied both diffs tomainf107ae044: they differ only in blob hashes and line offsets, and both fix the three backslash-TMPDIRfailures identically.Nothing wrong with this branch — it just no longer needs to be merged on its own. Close it once #1792 lands (or let #1792 close in its favour if this draft is preferred, though the takeover copy is the ready one).
AI-assisted (review only).
Closing carried-over draft: superseded by live rebased PR #1792 (OLD-9861).