fix(saves): an old save that could not be deleted can still be read #2318

Merged
HumanBean merged 2 commits from pepe999/Longshot:fix/saves-leftover-readable into main 2026-11-23 00:32:45 +00:00
Contributor

Summary

After an import, scripts/longshot_saves.py deletes the save that was there. Where a delete is refused, it sets the file or folder writable and tries once more; what still can't be deleted stays, and the message says "delete it by hand". It set S_IWRITE alone, which on Linux is mode 0200: the folder left can't be listed, read or deleted by hand any more, and neither can the player's old save in it.

Now write is added to the mode it has. On Windows nothing changes: only the read-only bit is looked at there.

On main: test_old_save_that_cannot_be_deleted with the new lines. It did not see this before: it skips a folder it can't enter, and as root, as in CI, everything can be read.

How often a player meets it isn't known: on Linux a delete is refused for an immutable file or a network folder, not for a read-only file. The save imported and its backup are not affected.

Testing

Tested: Linux, no game run (the game doesn't run this script). tests/test_longshot_saves.py with the new lines fails on main ("slot_00": no read in its mode) and passes here, with Python 3.12 and 3.15.

tests/run_all.py --strict as a user who isn't root, in a container set up as ci.yml's job: 937 passed, 2 failed, 18 skipped; the 2 fail on main too (test_dev_packs, test_pipeline_state_computes: #2311).

Still to test: None.

Measurements

Nothing to measure: the mode given to a file whose delete was refused.

Risks

None known: a delete refused for the read-only bit on Windows still has it cleared (test_read_only_file_in_the_old_save). A revert is enough.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary After an import, `scripts/longshot_saves.py` deletes the save that was there. Where a delete is refused, it sets the file or folder writable and tries once more; what still can't be deleted stays, and the message says "delete it by hand". It set `S_IWRITE` **alone**, which on Linux is mode 0200: the folder left can't be listed, read or deleted by hand any more, and neither can the player's old save in it. Now write is added to the mode it has. On Windows nothing changes: only the read-only bit is looked at there. On `main`: `test_old_save_that_cannot_be_deleted` with the new lines. It did not see this before: it skips a folder it can't enter, and as root, as in CI, everything can be read. How often a player meets it isn't known: on Linux a delete is refused for an immutable file or a network folder, not for a read-only file. The save imported and its backup are not affected. ## Testing **Tested:** Linux, no game run (the game doesn't run this script). `tests/test_longshot_saves.py` with the new lines fails on `main` ("slot_00": no read in its mode) and passes here, with Python 3.12 and 3.15. `tests/run_all.py --strict` as a user who isn't root, in a container set up as `ci.yml`'s job: 937 passed, 2 failed, 18 skipped; the 2 fail on `main` too (test_dev_packs, test_pipeline_state_computes: #2311). **Still to test:** None. ## Measurements Nothing to measure: the mode given to a file whose delete was refused. ## Risks None known: a delete refused for the read-only bit on Windows still has it cleared (`test_read_only_file_in_the_old_save`). A revert is enough. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Fails on main: the folder left beside the saves has mode 0200, so nothing in
it can be read, listed or deleted by hand, which the message asks for. The
check did not see it: it skipped a folder it could not enter.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(saves): an old save that could not be deleted can still be read
Some checks are pending
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 7s
16432b3b0d
Where deleting the old save after an import was refused, longshot_saves.py
set the file or folder to S_IWRITE alone before trying again: on Linux 0200.
What stayed could not be read, listed or deleted by hand. It now adds write
to the mode it has.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
pepe999 changed title from WIP: fix(saves): an old save that could not be deleted can still be read to fix(saves): an old save that could not be deleted can still be read 2026-11-23 00:10:37 +00:00
HumanBean deleted branch fix/saves-leftover-readable 2026-11-23 00:32:45 +00:00
Some checks are pending
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 7s
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
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
MagicBeanDev/Longshot!2318
No description provided.