fix(release): reject read-only Windows destinations before promotion #5459

Merged
ideabsassistenza merged 2 commits from upstream-pr/5459 into main 2026-10-14 20:15:43 +00:00
ideabsassistenza commented 2026-10-13 20:14:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ideabsassistenza on 2026-10-13T20:14:23Z.


What

On Windows, an existing read-only release destination can fail replacement after earlier staged files have already been promoted. Blocking the ZIP leaves a new TAR with the old ZIP and executable; blocking the executable leaves both new archives with the old executable.

Reject a destination with the Windows read-only attribute during the existing preflight, before staging or promoting files. Inspect the destination itself with lexists/lstat, including dangling symlinks, rather than following its target. A writable link to a read-only target remains replaceable and the target stays intact. POSIX read-only permission bits continue allowing replacement in a writable directory.

The scope is this deterministic Windows attribute failure. This does not add general rollback for concurrent changes or later I/O failures. Related #674 concerns additional packaged assets; #5396 changes release workflow dependencies. No equivalent open fix found in refreshed release/packaging searches.

Tested

Rebased on 14 October 2026 onto main daf256baab2987313fa18423939b7a7fb6304f31. Current head d8e6922acb2c6dc80ddb3f31cddc7066a0413734, tree 8260d5f4e7144f9f3380643955dbecd1e9deb698. The only conflict was the packaging test imports; upstream json and this PR's stat/ctypes were all preserved. Range-diff confirms no production behavior changes. Current-head Windows packaging suite: 23 discovered, 22 passed, one POSIX skip, 0.843 s; conventions and whitespace checks pass. The full tools suite was not rerun for this import-only rebase; the earlier full-suite results below remain historical for head 66a798df2. No native/GPU/title tests or executable launches.

Windows 11, CPython 3.12.14. Based on a0f5916a293067ca840e835e58a8a55a0b764b4b; tested head 66a798df252e4bdd27830182452b823d19da93f4, tree f63dfcd7e6093e599c4e1fca26311b8f213f6b0a.

  • The identical final regression file run against unmodified main has three failures and one error: partial promotion for read-only ordinary destinations, and a read-only dangling destination bypassing exists().
  • All 18 locally executed packaging/documentation tests pass; one POSIX replacement control is skipped on Windows. Total: 19 tests in 0.725 seconds. Real Windows files and link attributes are used; no replacement-operation mocks.
  • Regressions protect all three previous asset contents and unrelated output, retain the blocked file's read-only attribute, preserve a read-only dangling link, and verify that a writable link to a read-only target is replaced without altering its target.
  • The full tool suite passes: 282 executed tests, one POSIX-specific skip (283 total), in 142.605 seconds. Conventions/whitespace checks pass and independent agent review found no remaining concrete issues. These results apply to the exact head and tree above.
  • No release was published and no executable or game was launched by these fixtures. Native production code is unchanged; no new native build, GPU or title validation is claimed. The POSIX-specific control is included for Linux/macOS runners.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source; none added
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Codex implementation, native filesystem regressions and independent agent review)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4848906121 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5459). Originally posted by [ideabsassistenza](https://github.com/ideabsassistenza) on 2026-10-13T20:14:23Z. --- ### What On Windows, an existing read-only release destination can fail replacement after earlier staged files have already been promoted. Blocking the ZIP leaves a new TAR with the old ZIP and executable; blocking the executable leaves both new archives with the old executable. Reject a destination with the Windows read-only attribute during the existing preflight, before staging or promoting files. Inspect the destination itself with `lexists`/`lstat`, including dangling symlinks, rather than following its target. A writable link to a read-only target remains replaceable and the target stays intact. POSIX read-only permission bits continue allowing replacement in a writable directory. The scope is this deterministic Windows attribute failure. This does not add general rollback for concurrent changes or later I/O failures. Related #674 concerns additional packaged assets; #5396 changes release workflow dependencies. No equivalent open fix found in refreshed release/packaging searches. ### Tested Rebased on 14 October 2026 onto main `daf256baab2987313fa18423939b7a7fb6304f31`. Current head `d8e6922acb2c6dc80ddb3f31cddc7066a0413734`, tree `8260d5f4e7144f9f3380643955dbecd1e9deb698`. The only conflict was the packaging test imports; upstream `json` and this PR's `stat`/`ctypes` were all preserved. Range-diff confirms no production behavior changes. Current-head Windows packaging suite: 23 discovered, 22 passed, one POSIX skip, 0.843 s; conventions and whitespace checks pass. The full tools suite was not rerun for this import-only rebase; the earlier full-suite results below remain historical for head `66a798df2`. No native/GPU/title tests or executable launches. Windows 11, CPython 3.12.14. Based on `a0f5916a293067ca840e835e58a8a55a0b764b4b`; tested head `66a798df252e4bdd27830182452b823d19da93f4`, tree `f63dfcd7e6093e599c4e1fca26311b8f213f6b0a`. - The identical final regression file run against unmodified main has three failures and one error: partial promotion for read-only ordinary destinations, and a read-only dangling destination bypassing `exists()`. - All 18 locally executed packaging/documentation tests pass; one POSIX replacement control is skipped on Windows. Total: 19 tests in 0.725 seconds. Real Windows files and link attributes are used; no replacement-operation mocks. - Regressions protect all three previous asset contents and unrelated output, retain the blocked file's read-only attribute, preserve a read-only dangling link, and verify that a writable link to a read-only target is replaced without altering its target. - The full tool suite passes: 282 executed tests, one POSIX-specific skip (283 total), in 142.605 seconds. Conventions/whitespace checks pass and independent agent review found no remaining concrete issues. These results apply to the exact head and tree above. - No release was published and no executable or game was launched by these fixtures. Native production code is unchanged; no new native build, GPU or title validation is claimed. The POSIX-specific control is included for Linux/macOS runners. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source; none added - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes (Codex implementation, native filesystem regressions and independent agent review)
adriadam10 commented 2026-10-14 19:49:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T19:49:56Z.


Checked the preflight change (tools/package_release.py:46: Windows-only lexists/lstat read-only attribute check, dangling links included) and the new regression tests against the code; build and ctest pass on Linux and the packaging suite passes (Windows-only cases skip here). Merging once the Windows job is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6176974425 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5459#issuecomment-6176974425). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T19:49:56Z. --- Checked the preflight change (`tools/package_release.py:46`: Windows-only `lexists`/`lstat` read-only attribute check, dangling links included) and the new regression tests against the code; build and ctest pass on Linux and the packaging suite passes (Windows-only cases skip here). Merging once the Windows job is green.
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
boykopovar/AnyPS5!5459
No description provided.