OLD-8161: restore old upstream PR 8161 - file_system: T: is a folder of each process's own in the overlay #684

Merged
aslan2142 merged 4 commits from upstream-pr/684 into main 2026-11-25 22:56:39 +00:00
aslan2142 commented 2026-11-24 11:56:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-24T11:56:19Z.


Claimed in the coordination issue as: OLD-8161 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7130586013

Restoration of my original pull request, old upstream PR 8161 in ItsNotRexed/Leonida, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Ported onto main at 21625bca8c; the port makes T:'s folder and reserve_unique_dir's creates go through main's win32_io_path, keeps the scratch-folder exception in the write-open path, and points main's long-overlay T: check at the process's own folder.

Depends on: #317 (textual conflict in parse_console), #379 (conflict in docs/boot.md)

What and why

  • Problem: T:\ mapped to <overlay>\.gta6rt-temp, one folder shared by every run and kept between runs.
    • The title makes its crash dump and crash log there with CREATE_NEW.
    • If an earlier run or a second process had left the same name, the create failed with ERROR_FILE_EXISTS (80) and no report landed. This was old upstream issue 7913, measured by Spacecer2 under Wine 11.22.
  • Fix: T:\ now names <overlay>\.gta6rt-temp\<YYYYMMDD-HHMMSS-mmm>-pid<id>, using the process's start time in UTC and its id. On the console, T: is the title's own temporary drive, empty at launch and shared with no other run.
  • Reservation: rt::fs::reserve_unique_dir takes the folder with a create-only CreateDirectoryW.
    • If that name already exists (a reused process id in the same millisecond, which Wine makes likely), it tries -2, -3, ... up to 1000 names, so no run writes into an older folder.
    • The reservation happens once per overlay, under a mutex.
    • If it fails, the reason is printed once and T: paths fail with ERROR_INVALID_NAME.
  • Unchanged behaviour:
    • T:\.. cannot climb into the shared folder.
    • T:\ still cannot be removed or moved.
    • Earlier runs' folders are kept, so their crash files can be read.
    • GAME: and G: are unchanged.
  • Startup line: it names the folder: console paths: GAME: -> ..., writes -> ..., T: -> .... rt::fs::scratch_dir() returns the folder. check_console_paths.cmake, check_game_dir.cmake and tests/test_console_paths.py expect the new part.
  • Docs: docs/boot.md and docs/runtime_imports.md describe the mapping.
  • Related: #287 (GetTempPath/GetTempFileName resolve to the overlay scratch folder) is complementary, not a conflict. It drops the first part parse_console returns, so it lands in this process's folder too.

Tested

Linux, Wine 11.22 (Staging), clang 23 targeting x86_64-w64-mingw32 (lld, static libstdc++). This is a local check only; the MSVC /W4 /permissive- build is left to CI.

  • file_system_test on main (21625bca8): 494 checks, 11 failures.
  • This PR's tests built against main's file_system.cpp (the new functions stubbed to main's behaviour): 519 checks, 27 failures, so the PR's checks add 16.
    • CreateFileW(T:\crash.dmp, CREATE_NEW) fails with 80 in this process and in the second process.
    • Every reserve_unique_dir check fails.
  • This branch: 519 checks, 11 failures, the same 11 as on main. The first commit alone gives 508 checks and the same 11 failures.
  • The 11 failures are Wine-only and fail on main too:
    • a host ReadFile into uncommitted pages does not fail with ERROR_NOACCESS (1);
    • MAXIMUM_ALLOWED write-opens of a package file through CreateFileW, CreateFileA and CreateFile2 (6);
    • long-path deletion markers and listings (3);
    • removing the synthetic long paths afterwards (1).
  • Other checks:
    • python -I tests/test_console_paths.py: OK.
    • run_tiny_game_console_paths and run_tiny_game_dir need the Windows gta6rt build and are left to CI.
    • git diff --check is clean.
    • python -I scripts/check_no_game_data.py on the 9 changed files is clean.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5471652830 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/684). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-24T11:56:19Z. --- Claimed in the coordination issue as: OLD-8161 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7130586013 Restoration of my original pull request, old upstream PR 8161 in `ItsNotRexed/Leonida`, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Ported onto main at 21625bca8c675c62f9dbffc318ce6a59d57faf31; the port makes `T:`'s folder and `reserve_unique_dir`'s creates go through main's `win32_io_path`, keeps the scratch-folder exception in the write-open path, and points main's long-overlay `T:` check at the process's own folder. Depends on: #317 (textual conflict in `parse_console`), #379 (conflict in `docs/boot.md`) ### What and why - **Problem:** `T:\` mapped to `<overlay>\.gta6rt-temp`, one folder shared by every run and kept between runs. - The title makes its crash dump and crash log there with `CREATE_NEW`. - If an earlier run or a second process had left the same name, the create failed with `ERROR_FILE_EXISTS` (80) and no report landed. This was old upstream issue 7913, measured by Spacecer2 under Wine 11.22. - **Fix:** `T:\` now names `<overlay>\.gta6rt-temp\<YYYYMMDD-HHMMSS-mmm>-pid<id>`, using the process's start time in UTC and its id. On the console, `T:` is the title's own temporary drive, empty at launch and shared with no other run. - **Reservation:** `rt::fs::reserve_unique_dir` takes the folder with a create-only `CreateDirectoryW`. - If that name already exists (a reused process id in the same millisecond, which Wine makes likely), it tries `-2`, `-3`, ... up to 1000 names, so no run writes into an older folder. - The reservation happens once per overlay, under a mutex. - If it fails, the reason is printed once and `T:` paths fail with `ERROR_INVALID_NAME`. - **Unchanged behaviour:** - `T:\..` cannot climb into the shared folder. - `T:\` still cannot be removed or moved. - Earlier runs' folders are kept, so their crash files can be read. - `GAME:` and `G:` are unchanged. - **Startup line:** it names the folder: `console paths: GAME: -> ..., writes -> ..., T: -> ...`. `rt::fs::scratch_dir()` returns the folder. `check_console_paths.cmake`, `check_game_dir.cmake` and `tests/test_console_paths.py` expect the new part. - **Docs:** `docs/boot.md` and `docs/runtime_imports.md` describe the mapping. - **Related:** #287 (`GetTempPath`/`GetTempFileName` resolve to the overlay scratch folder) is complementary, not a conflict. It drops the first part `parse_console` returns, so it lands in this process's folder too. ### Tested Linux, Wine 11.22 (Staging), clang 23 targeting `x86_64-w64-mingw32` (lld, static libstdc++). This is a local check only; the MSVC `/W4 /permissive-` build is left to CI. - **`file_system_test` on main (21625bca8):** 494 checks, 11 failures. - **This PR's tests built against main's `file_system.cpp`** (the new functions stubbed to main's behaviour): 519 checks, 27 failures, so the PR's checks add 16. - `CreateFileW(T:\crash.dmp, CREATE_NEW)` fails with 80 in this process and in the second process. - Every `reserve_unique_dir` check fails. - **This branch:** 519 checks, 11 failures, the same 11 as on main. The first commit alone gives 508 checks and the same 11 failures. - **The 11 failures are Wine-only and fail on main too:** - a host `ReadFile` into uncommitted pages does not fail with `ERROR_NOACCESS` (1); - `MAXIMUM_ALLOWED` write-opens of a package file through `CreateFileW`, `CreateFileA` and `CreateFile2` (6); - long-path deletion markers and listings (3); - removing the synthetic long paths afterwards (1). - **Other checks:** - `python -I tests/test_console_paths.py`: OK. - `run_tiny_game_console_paths` and `run_tiny_game_dir` need the Windows `gta6rt` build and are left to CI. - `git diff --check` is clean. - `python -I scripts/check_no_game_data.py` on the 9 changed files is clean. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) AI-assisted (Claude Code, Claude Opus 5.5).
abnalstlll-byte commented 2026-11-24 12:20:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T12:20:28Z.

Review: APPROVED


Reviewed and verified OLD-8161 restoration. Isolating guest process T: scratch directories under .gta6rt-temp<timestamp>-pid via atomic
eserve_unique_dir with CreateDirectoryW prevents cross-run file collision errors (ERROR_FILE_EXISTS) during crash dump creation. CTest coverage in
untime/tests/file_system_test.cpp and standard-library test ests/test_console_paths.py fully validate path resolution and isolation. Excellent work, approved.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6039084149 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/684#pullrequestreview-6039084149). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T12:20:28Z. **Review:** APPROVED --- Reviewed and verified OLD-8161 restoration. Isolating guest process T: scratch directories under <overlay>\.gta6rt-temp\<timestamp>-pid<id> via atomic eserve_unique_dir with CreateDirectoryW prevents cross-run file collision errors (ERROR_FILE_EXISTS) during crash dump creation. CTest coverage in untime/tests/file_system_test.cpp and standard-library test ests/test_console_paths.py fully validate path resolution and isolation. Excellent work, approved.
aslan2142 commented 2026-11-25 22:56:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T22:56:41Z.


Merged: file_system: T: is a folder of each process's own in the overlay.

  • Changed since review: main merged in. The one conflict was in docs/boot.md, where main added LEONIDA_WRITE_DIR / LEONIDA_SAVE_DIR to the --overlay bullet and a new "Under Wine on Linux" section. Both are kept, with the T: paragraph after main's sentences (c116c3fa2).
  • Tested: the full Windows suite under Wine on main 5fab93967 with all nine of these runtime PRs merged together (#634, #643, #684, #657, #677, #638, #710, #688, #671), on llvmpipe and the gfx1036 iGPU (RADV): no test went from pass to fail. file_system fails only on the BCryptOpenAlgorithmProvider check, as on the baseline. test_console_paths.py passes.
  • Checked on main 6ef26a648 + c116c3fa2: it merges cleanly; the semantic suite passes (493 files, 6,318 tests, 0 files failed); the 15 docs and writer tests pass; check_no_game_data.py is clean on the 9 changed files.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7176966795 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/684#issuecomment-7176966795). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-25T22:56:41Z. --- Merged: `file_system`: `T:` is a folder of each process's own in the overlay. - **Changed since review:** `main` merged in. The one conflict was in `docs/boot.md`, where `main` added `LEONIDA_WRITE_DIR` / `LEONIDA_SAVE_DIR` to the `--overlay` bullet and a new "Under Wine on Linux" section. Both are kept, with the `T:` paragraph after `main`'s sentences (`c116c3fa2`). - **Tested:** the full Windows suite under Wine on `main` `5fab93967` with all nine of these runtime PRs merged together (#634, #643, #684, #657, #677, #638, #710, #688, #671), on llvmpipe and the gfx1036 iGPU (RADV): no test went from pass to fail. `file_system` fails only on the `BCryptOpenAlgorithmProvider` check, as on the baseline. `test_console_paths.py` passes. - **Checked on `main` `6ef26a648` + `c116c3fa2`:** it merges cleanly; the semantic suite passes (493 files, 6,318 tests, 0 files failed); the 15 docs and writer tests pass; `check_no_game_data.py` is clean on the 9 changed files. AI-assisted (Claude Code, Claude Opus 5.5).
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!684
No description provided.