[PR #293] [CLOSED] spirv_asm: refuse an output that aliases the source (SPIRV-ASM-INPUT-ALIAS) #345

Closed
opened 2026-11-26 20:17:35 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/293
Author: @Andretuta
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: old-pr/10025


📝 Commits (1)

  • 8e33f78 spirv_asm: refuse an output that aliases the source

📊 Changes

2 files changed (+33 additions, -0 deletions)

View changed files

📝 tests/test_spirv_asm.py (+30 -0)
📝 tools/spirv_asm.py (+3 -0)

📄 Description

Carried over from old PR 10025 by comigor in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/10025, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
comigor: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

What

Prevent tools/spirv_asm.py from overwriting its input when -o names the same file. The check uses the existing same_report_path helper, so it also covers normalized paths, hard links and symlinks, and exits with argparse's usage-error code 2 before reading or writing either path.

Adds CLI regressions for the direct path, a sub/../ spelling, a hard link and a symlink. Each case verifies both the exit code and that the original source bytes survive.

Coordination item: SPIRV-ASM-INPUT-ALIAS (#9677).

Tests

  • python -I tests/test_spirv_asm.py — 32 tests OK, 2 environment skips (including symlink creation on this Windows account)
  • python -I tests/test_report_paths.py — 22 tests OK, 1 environment skip
  • python -I tests/test_run_gpu_tests_python_assembler.py — 6 tests OK
  • python -m compileall -q make_game.py tools tests
  • git diff --check
  • The new regression was run before the production change: direct, normalized and hard-link cases failed with exit 0; all pass after the guard.

CPU-only synthetic files; no game data or GPU required.

AI-assisted: yes (Kimi).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/293 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `old-pr/10025` --- ### 📝 Commits (1) - [`8e33f78`](https://github.com/ubiquitarianism/leonida/commit/8e33f7866a01e78ca39580b5178f9e43f0181f80) spirv_asm: refuse an output that aliases the source ### 📊 Changes **2 files changed** (+33 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_spirv_asm.py` (+30 -0) 📝 `tools/spirv_asm.py` (+3 -0) </details> ### 📄 Description > Carried over from **old PR 10025** by `comigor` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/10025`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `comigor`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): ## What Prevent `tools/spirv_asm.py` from overwriting its input when `-o` names the same file. The check uses the existing `same_report_path` helper, so it also covers normalized paths, hard links and symlinks, and exits with argparse's usage-error code 2 before reading or writing either path. Adds CLI regressions for the direct path, a `sub/../` spelling, a hard link and a symlink. Each case verifies both the exit code and that the original source bytes survive. Coordination item: **SPIRV-ASM-INPUT-ALIAS** (`#9677`). ## Tests - `python -I tests/test_spirv_asm.py` — 32 tests OK, 2 environment skips (including symlink creation on this Windows account) - `python -I tests/test_report_paths.py` — 22 tests OK, 1 environment skip - `python -I tests/test_run_gpu_tests_python_assembler.py` — 6 tests OK - `python -m compileall -q make_game.py tools tests` - `git diff --check` - The new regression was run before the production change: direct, normalized and hard-link cases failed with exit 0; all pass after the guard. CPU-only synthetic files; no game data or GPU required. AI-assisted: yes (Kimi). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:17:35 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#345
No description provided.