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

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/684
Author: @aslan2142
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142

Base: main ← Head: t-drive-overlay


📝 Commits (4)

  • 297ad86 file_system: T: is a folder of each process's own in the overlay
  • 1d37e03 file_system: reserve T:'s folder with a create-only call, never reuse one
  • 5866d69 Merge main into OLD-8161, T: overlay folder per process (#684)
  • c116c3f Merge main into t-drive-overlay

📊 Changes

9 files changed (+391 additions, -30 deletions)

View changed files

📝 docs/boot.md (+10 -1)
📝 docs/runtime_imports.md (+11 -4)
📝 runtime/shims/file_system.cpp (+100 -7)
📝 runtime/shims/file_system.h (+13 -0)
📝 runtime/src/main.cpp (+7 -3)
📝 runtime/test/check_console_paths.cmake (+3 -3)
📝 runtime/test/check_game_dir.cmake (+3 -2)
📝 runtime/test/file_system_test.cpp (+242 -9)
📝 tests/test_console_paths.py (+2 -1)

📄 Description

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).


🔄 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/684 **Author:** [@aslan2142](https://github.com/aslan2142) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/25/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `t-drive-overlay` --- ### 📝 Commits (4) - [`297ad86`](https://github.com/ubiquitarianism/leonida/commit/297ad8685486dc9523d492e8fce19ae4aa52429b) file_system: T: is a folder of each process's own in the overlay - [`1d37e03`](https://github.com/ubiquitarianism/leonida/commit/1d37e033eb7094f922492de777ee8f1d5cc63b23) file_system: reserve T:'s folder with a create-only call, never reuse one - [`5866d69`](https://github.com/ubiquitarianism/leonida/commit/5866d6974e86fc2d39e6ce0691af63b354f6c8b9) Merge main into OLD-8161, T: overlay folder per process (#684) - [`c116c3f`](https://github.com/ubiquitarianism/leonida/commit/c116c3fa28983444cd47feea0461e1e7eaac83b5) Merge main into t-drive-overlay ### 📊 Changes **9 files changed** (+391 additions, -30 deletions) <details> <summary>View changed files</summary> 📝 `docs/boot.md` (+10 -1) 📝 `docs/runtime_imports.md` (+11 -4) 📝 `runtime/shims/file_system.cpp` (+100 -7) 📝 `runtime/shims/file_system.h` (+13 -0) 📝 `runtime/src/main.cpp` (+7 -3) 📝 `runtime/test/check_console_paths.cmake` (+3 -3) 📝 `runtime/test/check_game_dir.cmake` (+3 -2) 📝 `runtime/test/file_system_test.cpp` (+242 -9) 📝 `tests/test_console_paths.py` (+2 -1) </details> ### 📄 Description 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). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:50 +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#724
No description provided.