RPF: commit an extracted record past MAX_PATH with a verbatim path #1072

Open
github-bot wants to merge 1 commit from github-bot/gh-1072 into main AGit
Owner

@⁠iggyvilla on GitHub · 2026-11-24 11:17 UTC · original
iggyvilla:xcl-rpf-long-path → main · +68 −2 · 1 files · 1 commits · open

xcl rpf --extract ... --out <folder> writes each record through atomic_write_with, which moved its temporary file into place with MoveFileExW on the plain paths. That call fails with error 3 ("The system cannot find the path specified") for a path of MAX_PATH characters or more, although the folder and the temporary file exist; std's own file calls add the \\?\ prefix, this one did not. So an extraction into a deep output folder failed. move_path now gives MoveFileExW the absolute path, prefixed with \\?\ (or \\?\UNC\) when it is 260 characters or longer; shorter, verbatim and device paths are unchanged. The same mistake in the XGameSave code is #922's; this PR does not touch that file.

What is in it

  • crates/xcl/src/rpf.rs: move_path and its two uses in atomic_write_with (+68/-2 with tests).
  • Tests, same file: move_path_prefixes_only_what_is_past_max_path (drive, UNC, short, verbatim, verbatim UNC, device, the 259 and 260-character edges, .. folded) and atomic_write_commits_past_max_path (a real write into a 300+ character path; it fails with error 3 without the change).

Tested

  • AMD Radeon RX 6650 XT (RDNA2), Windows 10.0.26300, rustc 1.100.0, debug.
  • cargo test -p xcl --lib rpf::tests: 7 passed, 0 failed, 0 ignored. Without the change atomic_write_commits_past_max_path fails with Os { code: 3, kind: NotFound }.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on 6de9cf7: 726 passed, 3 failed, 41 ignored, 0 SKIPPED. The 3 failures are the ones already on main: placed_title_textures_share_vram_and_preserve_pixels (also fails alone; the packed-mip bug #470 fixes), and transitions_apply_when_their_list_is_submitted and d32s8_targets_take_their_own_size_of_video_memory (PoisonError after it; they pass alone; #673).

Regression run

The change is in xcl rpf, which a title run does not reach, so this only shows that nothing else moved. After an unmeasured warm-up of each build, with no other build or title run on the machine, the runs alternated: head 446, main 447, main 445, head 444 frames; no device removals or crashes. The second pair is shown.

main:

xcl-smoke v1
commit: 6efdabcdaac93ce5cc123a85e85deba5d49cb294
gpu: AMD Radeon RX 6650 XT
title: retail
seconds: 60
exit: 0x0
frames shown: 445 (PresentX 451)
presents per 2 s (last 3): 59 41 0
device removals: 0
crashes: 0
peak commit: 15271 MB

This PR:

xcl-smoke v1
commit: 6de9cf7945400f125efe10bf14a5e8f80cde81f2
gpu: AMD Radeon RX 6650 XT
title: retail
seconds: 60
exit: 0x0
frames shown: 444 (PresentX 448)
presents per 2 s (last 3): 58 42 0
device removals: 0
crashes: 0
peak commit: 15268 MB

Not tested

  • xcl rpf on a real package into a deep folder (only the synthetic archive tests and the direct atomic_write test).
  • Long network (UNC) paths: the prefix is unit-tested, not run against a share.
  • Other MoveFileExW callers (XGameSave: #922).

AI use

  • Claude Code, Claude Sonnet 5.5 (claude-sonnet-5-5): wrote the change, the tests and this description, and ran the tests above.
**@⁠iggyvilla** on GitHub · 2026-11-24 11:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/1072) `iggyvilla:xcl-rpf-long-path` → `main` · +68 −2 · 1 files · 1 commits · open `xcl rpf --extract ... --out <folder>` writes each record through `atomic_write_with`, which moved its temporary file into place with `MoveFileExW` on the plain paths. That call fails with error 3 ("The system cannot find the path specified") for a path of `MAX_PATH` characters or more, although the folder and the temporary file exist; std's own file calls add the `\\?\` prefix, this one did not. So an extraction into a deep output folder failed. `move_path` now gives `MoveFileExW` the absolute path, prefixed with `\\?\` (or `\\?\UNC\`) when it is 260 characters or longer; shorter, verbatim and device paths are unchanged. The same mistake in the XGameSave code is #922's; this PR does not touch that file. **What is in it** - `crates/xcl/src/rpf.rs`: `move_path` and its two uses in `atomic_write_with` (+68/-2 with tests). - Tests, same file: `move_path_prefixes_only_what_is_past_max_path` (drive, UNC, short, verbatim, verbatim UNC, device, the 259 and 260-character edges, `..` folded) and `atomic_write_commits_past_max_path` (a real write into a 300+ character path; it fails with error 3 without the change). **Tested** - AMD Radeon RX 6650 XT (RDNA2), Windows 10.0.26300, rustc 1.100.0, debug. - `cargo test -p xcl --lib rpf::tests`: 7 passed, 0 failed, 0 ignored. Without the change `atomic_write_commits_past_max_path` fails with `Os { code: 3, kind: NotFound }`. - `cargo test --workspace --no-fail-fast -- --test-threads=4` on `6de9cf7`: 726 passed, 3 failed, 41 ignored, 0 SKIPPED. The 3 failures are the ones already on `main`: `placed_title_textures_share_vram_and_preserve_pixels` (also fails alone; the packed-mip bug #470 fixes), and `transitions_apply_when_their_list_is_submitted` and `d32s8_targets_take_their_own_size_of_video_memory` (`PoisonError` after it; they pass alone; #673). **Regression run** The change is in `xcl rpf`, which a title run does not reach, so this only shows that nothing else moved. After an unmeasured warm-up of each build, with no other build or title run on the machine, the runs alternated: head 446, `main` 447, `main` 445, head 444 frames; no device removals or crashes. The second pair is shown. `main`: ``` xcl-smoke v1 commit: 6efdabcdaac93ce5cc123a85e85deba5d49cb294 gpu: AMD Radeon RX 6650 XT title: retail seconds: 60 exit: 0x0 frames shown: 445 (PresentX 451) presents per 2 s (last 3): 59 41 0 device removals: 0 crashes: 0 peak commit: 15271 MB ``` This PR: ``` xcl-smoke v1 commit: 6de9cf7945400f125efe10bf14a5e8f80cde81f2 gpu: AMD Radeon RX 6650 XT title: retail seconds: 60 exit: 0x0 frames shown: 444 (PresentX 448) presents per 2 s (last 3): 58 42 0 device removals: 0 crashes: 0 peak commit: 15268 MB ``` **Not tested** - `xcl rpf` on a real package into a deep folder (only the synthetic archive tests and the direct `atomic_write` test). - Long network (UNC) paths: the prefix is unit-tested, not run against a share. - Other `MoveFileExW` callers (XGameSave: #922). **AI use** - Claude Code, Claude Sonnet 5.5 (`claude-sonnet-5-5`): wrote the change, the tests and this description, and ran the tests above.
atomic_write_with moved its temporary file into place with MoveFileExW on
the plain paths. That call fails with error 3 (path not found) for a path
of MAX_PATH characters or more, although the folder and the temporary file
exist (std's own file calls add the \\?\ prefix, this one does not). So
`xcl rpf --extract ... --out <deep folder>` failed on records whose output
path is 260 characters or longer.

move_path gives MoveFileExW the absolute path, prefixed with \\?\ (or
\\?\UNC\) when it is 260 characters or longer; shorter, verbatim and device
paths are unchanged.

Assisted-by: Claude Code (Claude Sonnet 5.5)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:42:33 +00:00
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-24 14:25 UTC · original

Full-suite run, since this PR has no test report yet. Tested exact head 6de9cf7 (on its base 6efdabc).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 729 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: move_path_prefixes_only_what_is_past_max_path, atomic_write_commits_past_max_path.

Not tested

  • AMD, a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-24 14:25 UTC · [original](https://github.com/xcl-dev/xcl/pull/1072#issuecomment-7134341116) Full-suite run, since this PR has no test report yet. Tested exact head `6de9cf7` (on its base `6efdabc`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4`: **729 passed, 0 failed, 41 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - The new tests ran and passed: `move_path_prefixes_only_what_is_past_max_path`, `atomic_write_commits_past_max_path`. **Not tested** - AMD, a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠kacper-serewis on GitHub · 2026-11-24 20:22 UTC · original

On 6de9cf7, a destination in NT form (\??\C:\...\record.bin; short path, existing folder) fails: atomic_write works on the base 6efdabc and returns error 123 (ERROR_INVALID_NAME) with the PR.

Tested: Windows 11, debug, CPU only.

std::path::absolute treats \??\ as a root-relative path. Suggested, at the top of move_path:

    // std::path::absolute treats the NT prefix as a root-relative DOS path
    if path.as_os_str().as_encoded_bytes().starts_with(br"\??\") {
        return Ok(path.as_os_str().encode_wide().chain([0]).collect());
    }

With it on 6de9cf7 the test below and the PR's own pass (cargo test -p xcl --lib rpf::: 8 passed, 0 failed).

Test (append to rpf.rs)
#[cfg(test)]
mod nt_probe {
    use super::*;
    use std::time::{SystemTime, UNIX_EPOCH};
    #[test]
    fn nt_form_destination_commits() {
        let nonce = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_nanos();
        let root = std::env::temp_dir().join(format!("xcl-rpf-nt-{}-{nonce}", std::process::id()));
        std::fs::create_dir_all(&root).unwrap();
        let nt = std::path::PathBuf::from(format!(r"\??\{}\record.bin", root.display()));
        let r = atomic_write(&nt, b"payload");
        let data = std::fs::read(root.join("record.bin"));
        std::fs::remove_dir_all(&root).unwrap();
        assert!(r.is_ok(), "{r:?}");
        assert_eq!(data.unwrap(), b"payload");
    }
}

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this comment; the suggested change was written with T3 Code (gpt-6.2-astra). I checked the points before posting.

**@⁠kacper-serewis** on GitHub · 2026-11-24 20:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/1072#issuecomment-7143447556) On `6de9cf7`, a destination in NT form (`\??\C:\...\record.bin`; short path, existing folder) fails: `atomic_write` works on the base `6efdabc` and returns error 123 (`ERROR_INVALID_NAME`) with the PR. **Tested:** Windows 11, debug, CPU only. `std::path::absolute` treats `\??\` as a root-relative path. Suggested, at the top of `move_path`: ```rust // std::path::absolute treats the NT prefix as a root-relative DOS path if path.as_os_str().as_encoded_bytes().starts_with(br"\??\") { return Ok(path.as_os_str().encode_wide().chain([0]).collect()); } ``` With it on `6de9cf7` the test below and the PR's own pass (`cargo test -p xcl --lib rpf::`: 8 passed, 0 failed). <details><summary>Test (append to rpf.rs)</summary> ```rust #[cfg(test)] mod nt_probe { use super::*; use std::time::{SystemTime, UNIX_EPOCH}; #[test] fn nt_form_destination_commits() { let nonce = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_nanos(); let root = std::env::temp_dir().join(format!("xcl-rpf-nt-{}-{nonce}", std::process::id())); std::fs::create_dir_all(&root).unwrap(); let nt = std::path::PathBuf::from(format!(r"\??\{}\record.bin", root.display())); let r = atomic_write(&nt, b"payload"); let data = std::fs::read(root.join("record.bin")); std::fs::remove_dir_all(&root).unwrap(); assert!(r.is_ok(), "{r:?}"); assert_eq!(data.unwrap(), b"payload"); } } ``` </details> **AI use:** Claude Code (Claude Opus 5.5) ran the tests and wrote this comment; the suggested change was written with T3 Code (gpt-6.2-astra). I checked the points before posting.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 08:51 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 08:51 UTC · [original](https://github.com/xcl-dev/xcl/pull/1072#issuecomment-7157558464) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1072/head:github-bot/gh-1072'
git switch 'github-bot/gh-1072'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1072'
git switch 'github-bot/gh-1072'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1072'
git switch 'github-bot/gh-1072'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1072'
git switch 'main'
git merge --squash 'github-bot/gh-1072'
git switch 'main'
git merge --ff-only 'github-bot/gh-1072'
git switch 'main'
git merge 'github-bot/gh-1072'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.