spirv_asm: refuse an output that aliases the source (OLD-10025) #1254

Closed
wetw0rks-c0ding wants to merge 0 commits from upstream-pr/1254 into main
wetw0rks-c0ding commented 2026-11-24 20:55:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by wetw0rks-c0ding on 2026-11-24T20:55:44Z.


Claimed in the coordination issue as: OLD-10025

What and why

tools/spirv_asm.py would overwrite its input file if the requested output aliased the source, destroying the assembly input. It now refuses such an output and a regression test pins the behaviour.

Tested

  • python3 -m unittest tests/test_spirv_asm.py -> Ran 38 tests, OK (exit 0)
  • python -I scripts/check_no_game_data.py tools/spirv_asm.py tests/test_spirv_asm.py -> clean (exit 0)
  • Environment: Linux (CachyOS), CPU-only tests, no GPU required

AI-assisted: Yes. This work was done with OpenCode agents.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5480179166 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1254). Originally posted by [wetw0rks-c0ding](https://github.com/wetw0rks-c0ding) on 2026-11-24T20:55:44Z. --- Claimed in the coordination issue as: OLD-10025 ### What and why `tools/spirv_asm.py` would overwrite its input file if the requested output aliased the source, destroying the assembly input. It now refuses such an output and a regression test pins the behaviour. ### Tested - `python3 -m unittest tests/test_spirv_asm.py` -> Ran 38 tests, OK (exit 0) - `python -I scripts/check_no_game_data.py tools/spirv_asm.py tests/test_spirv_asm.py` -> clean (exit 0) - Environment: Linux (CachyOS), CPU-only tests, no GPU required AI-assisted: Yes. This work was done with OpenCode agents.
fin-github commented 2026-11-24 21:48:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fin-github on 2026-11-24T21:48:47Z.


This makes the same change as #938 (SPIRV-ASM-INPUT-ALIAS), which was opened about 5½ hours earlier: the added lines in tools/spirv_asm.py and tests/test_spirv_asm.py are identical. They probably both come from old upstream PR 10025. Only one of the two can merge. Could we keep #938 and close this one? If you'd rather carry it, say so and I'll close mine. AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7145421117 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1254#issuecomment-7145421117). Originally posted by [fin-github](https://github.com/fin-github) on 2026-11-24T21:48:47Z. --- This makes the same change as #938 (`SPIRV-ASM-INPUT-ALIAS`), which was opened about 5½ hours earlier: the added lines in `tools/spirv_asm.py` and `tests/test_spirv_asm.py` are identical. They probably both come from old upstream PR 10025. Only one of the two can merge. Could we keep #938 and close this one? If you'd rather carry it, say so and I'll close mine. AI-assisted (Claude Code).
nicoco23 commented 2026-11-24 22:09:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by nicoco23 on 2026-11-24T22:09:56Z.

Review: CHANGES_REQUESTED


Reviewed the diff and ran the tests: python -m unittest tests/test_spirv_asm.py on Windows 11, Python 3.12, 38 tests, OK.

The check is in the right place (right after argument parsing, before the source is read), exits with 2 through ap.error and leaves the source untouched. same_report_path resolves both paths with realpath and falls back to samefile, so the hard link and symlink subtests are real checks rather than string comparisons.

Notes, none blocking:

  • The symlink and hard link subtests are skipped when the OS refuses them (typically symlinks on Windows without developer mode), so they may not run on every machine.
  • The test does not cover two paths that differ only by case on Windows or macOS. [same_report_path may already handle that through _resolved_key; a subtest would pin it.]
  • [One check is failing on the PR: . It looks unrelated to this change / I did not look into it.]

NOT AI-assisted review.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6048199702 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1254#pullrequestreview-6048199702). Originally posted by [nicoco23](https://github.com/nicoco23) on 2026-11-24T22:09:56Z. **Review:** CHANGES_REQUESTED --- Reviewed the diff and ran the tests: `python -m unittest tests/test_spirv_asm.py` on Windows 11, Python 3.12, 38 tests, OK. The check is in the right place (right after argument parsing, before the source is read), exits with 2 through ap.error and leaves the source untouched. same_report_path resolves both paths with realpath and falls back to samefile, so the hard link and symlink subtests are real checks rather than string comparisons. Notes, none blocking: - The symlink and hard link subtests are skipped when the OS refuses them (typically symlinks on Windows without developer mode), so they may not run on every machine. - The test does not cover two paths that differ only by case on Windows or macOS. [same_report_path may already handle that through _resolved_key; a subtest would pin it.] - [One check is failing on the PR: <name>. It looks unrelated to this change / I did not look into it.] NOT AI-assisted review.
wetw0rks-c0ding commented 2026-11-24 23:33:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by wetw0rks-c0ding on 2026-11-24T23:33:12Z.


Closing this as a duplicate: another contributor's #938 (spirv_asm: refuse an output that aliases the source, SPIRV-ASM-INPUT-ALIAS / DRAFT-293) came first and is already merged. Thanks for the contribution.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7147530103 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1254#issuecomment-7147530103). Originally posted by [wetw0rks-c0ding](https://github.com/wetw0rks-c0ding) on 2026-11-24T23:33:12Z. --- Closing this as a duplicate: another contributor's #938 (spirv_asm: refuse an output that aliases the source, SPIRV-ASM-INPUT-ALIAS / DRAFT-293) came first and is already merged. Thanks for the contribution.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1254
No description provided.