mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:10:53 +01:00
[PR #2264] spirv_asm: validate --out upfront, accept UTF-8 BOM, and write atomically #2267
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#2267
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/2264
Author: @kirigayakazima
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:fix/spirv-asm-cli-safety📝 Commits (1)
9569d18spirv_asm: validate --out upfront, accept UTF-8 BOM, and write atomically📊 Changes
2 files changed (+125 additions, -3 deletions)
View changed files
📝
tests/test_spirv_asm.py(+82 -0)📝
tools/spirv_asm.py(+43 -3)📄 Description
Claimed in the coordination issue as: SPIRV-ASM-CLI-BOM-DIR-GUARD-AND-ATOMIC-WRITE (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7191092674)
What and why
tools/spirv_asm.pypreviously:.spvasminput before validating--out, causing full assembly before rejecting empty paths, directories, or missing parent directories..spvasmwith"utf-8"instead of"utf-8-sig", rejecting UTF-8 BOM inputs withunknown opcode '\ufeff...'..spvoutput directly in place withopen(args.out, "wb"), risking truncated or corrupted existing outputs if a write failed partway.This adds
_check_out_pathupfront inmain(), reads source files withutf-8-sig(keepingnewline=""), publishes assembled SPIR-V atomically withtempfile+file_mode.published_mode+replace_retry.replace, and adds unit/CLI tests covering all three behaviors.Tested
python -I tests/test_spirv_asm.py -v: 41 tests run (40 passed; 1 skipped:spirv-as not installed)upstream/mainbaseline negative control: failed on the new CLI tests before the fixpython -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, andgit diff --cached --checkGPUs 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.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.