Skip to content

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

Open
iggyvilla wants to merge 1 commit into
xcl-dev:mainfrom
iggyvilla:xcl-rpf-long-path
Open

iggyvilla wants to merge 1 commit into
xcl-dev:mainfrom
iggyvilla:xcl-rpf-long-path

Conversation

@iggyvilla

Copy link
Copy Markdown
Collaborator

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 D3D12.X: map a one-slice title texture's packed mips where D3D12 addresses them #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; Tests: a panicking title-texture test no longer poisons the others #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

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)
@futurepro62

Copy link
Copy Markdown

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.

kacper-serewis pushed a commit to kacper-serewis/xcl that referenced this pull request Nov 24, 2026
Adapt xcl-dev#1072 with NT-prefix preservation. Real extractor probes verified the payload and destination handling on long drive and UNC paths and restored the short NT-path behavior.

Assisted-by: T3 Code (gpt-6.2-astra)
@kacper-serewis

Copy link
Copy Markdown

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.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

@throny

throny commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

merge-check claim
head: 6de9cf7

@throny

throny commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

merge-check
base: 2c717a0
head: 6de9cf7
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1468 passed, 0 failed, 47 ignored (26 SKIPPED lines); base alone: 1466 passed, 0 failed, 47 ignored (26 SKIPPED lines)
review: one open point from the thread, still on this head: a path given in the NT form (backslash, two question marks, backslash, then the drive) worked on main and fails with error 123 with this PR; the fix suggested there is not in the diff. Otherwise fine: the path is made absolute (which folds '..') before the verbatim prefix is added, UNC paths get the UNC form, verbatim and device paths are left alone; record names are still sanitised by extraction_path, which the PR does not change, so nothing can be written outside the extraction root.
performance: none (CLI extraction only).
verdict: not yet: handle the NT-form path (or say it is out of scope and have the maintainer accept that); small, I will re-check on a new head.
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).

@KOLESNiii

Copy link
Copy Markdown
Contributor

merge-check claim
head: 6de9cf7

@JJAutoCompare

Copy link
Copy Markdown

Tested

Clean 6de9cf7945400f125efe10bf14a5e8f80cde81f2 on native Windows 11 25H2 build 26200.9974, Ryzen 7 3800X, fixed NTFS C: volume, and Rust 1.100.1 MSVC x64 debug. I reran the hash-pinned stock xcl.exe against two hash-verified synthetic archives.

  • xcl.exe rpf <original.rpf> --extract Probe: --out <directory> used ordinary absolute C: paths. Both extracted payloads matched byte-for-byte at each resolved final path length of 259, 260, and 320 UTF-16 units, excluding the terminator.
  • xcl.exe rpf <collision.rpf> --extract Probe: --out <same 320-unit case directory> preserved both original files and wrote the two new payloads byte-for-byte to Probe_Harbor.00000040 and Probe_Meadow.00000075, at 329 UTF-16 units each.

4 CLI cases passed, 0 failed or skipped. All four native processes exited 0 and reported two extractions each. Every destination contained exactly the expected files, with no temporary files left behind.

Not tested

NT-device paths, UNC paths, the base revision, release builds, XGameSave, retail packages or smoke, GPU execution, and the full workspace suite.

AI use

T3 Code through the Codex harness (gpt-6.2-sol) verified the executable and synthetic inputs, ran the CLI checks, and wrote this report.

@KOLESNiii

KOLESNiii commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

merge-check
base: e429936
head: 6de9cf7
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2128 passed, 9 failed, 48 ignored, 25 SKIPPED: 21 no wave64, 3 per-lane f16/f32 forms refused (#1426 semantics), 1 no heap windows; failing: gpu::dxil::module::split::tests::dispatch_chain_oversized_loop_matches_whole, gpu::dxil::module::split::tests::dispatch_chain_wave32_live_loops, gpu::dxil::module::split::tests::dispatch_chain_wave64_live_loops_and_exchange, gpu::recomp::heap_window_tests::gpu_heap_flat_reads_match_guarded_and_root_output, gpu::recomp::tests::gpu_compute_mode_dispatch_abi, gpu::recomp::tests::gpu_float_cas_uses_ieee_equality, test_title_draws_with_a_root_signature_under_the_debug_layer, test_title_runs_and_game_folder_is_untouched, test_title_runs_under_the_debug_layer_with_dred: these 9 fail on the base too (the base e429936's suite, run alone on this PC with the same command: 2126 passed, 9 failed, 48 ignored, 25 SKIPPED, these same 9 failing), and each also failed when rerun alone on this merge (the two debug-layer e2e tests stop on the D3D12 debug layer rejecting a pixel shader as corrupt or unsigned, and test_title_runs_and_game_folder_is_untouched on the test title's console command list memory-methods check, "post-Wait32/64 write failed"); not caused by this PR. The suite ran on this PC at the same time as 4 other PRs' suites, in one queued job.
review: none. Whole diff read (rpf.rs move_path: absolute path, \?\ or \?\UNC\ prefix at 260 characters or more, verbatim and device paths left alone; atomic_write_with uses it for both MoveFileExW paths; 2 tests). std's file calls already handle long paths; MoveFileExW does not, which this covers. A relative path becomes absolute against the same current directory MoveFileExW would have used.
performance: no runtime cost of note (one path conversion per extracted file commit).
verdict: safe to merge
hardware / tool and model: Windows 11 build 26300.9974, NVIDIA GeForce RTX 2070 SUPER 8 GB (driver 621.40, wave32 only), AMD Ryzen 5 3600XT; rustc 1.100.1 (20ddd0171 2026-11-25) x86_64-pc-windows-msvc, debug test profile; trial merge 7ac72d5d5613e6144117c78244fcf9f4b5beb7ee (local, not pushed). Claude Code: Claude Opus 5.5 (coordination, full-diff review, draft).
correction (2026-11-28): the base counts above were first given as 2128 passed: that base run reused this PC's merge test binary (one cargo target dir for both sides). The base was rerun with its own target dir; the same 9 tests fail on it, so the classification and the verdict stand.

@Parakeet-Wheat

Parakeet-Wheat commented Nov 30, 2026 •

Copy link
Copy Markdown

merge-check
base: 86e86fc
head: 6de9cf7
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2891 passed, 0 failed, 51 ignored; SKIPPED: 26 (22 no wave64, 2 no heap windows, 1 driver cache needs Developer Mode, 1 no GPU_UPLOAD heaps); failing: none
review: Whole diff read. The fix works: with the two MoveFileExW call sites put back on the raw path, atomic_write_commits_past_max_path fails with error 3. With the PR, it passes. The NT-form point from kacper-serewis is still open on this head. We added a test that calls atomic_write with a short NT-form path (\??\ and an absolute path in the temp folder). With main's rpf.rs, it writes the file. With this PR's rpf.rs, it fails with error 123, and no file is written. std::path::absolute reads \??\ as a root-relative path. The early return that kacper-serewis suggested is not in the diff.
performance: none: one path conversion per extracted file commit.
verdict: not yet: an NT-form destination that works on main fails with error 123 on this head. Add the suggested \??\ early return, or have a maintainer accept the change in scope.
hardware / tool and model: RTX 3070 8 GB (610.88), AMD Ryzen 5 5600X, Windows 11 Home 26300, Rust 1.95.0, debug / Claude Code, Claude Opus 5.5 (merge, build, suite, hand mutation, NT-path test and review)

@github-actions github-actions Bot added the checks-disagree Merge-checks disagree (safe vs not yet); needs maintainer/3rd look label Nov 30, 2026
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Triage (#1607) – head 6de9cf7

No open or merged PR makes the same change; main's rpf.rs:atomic_write_with still passes plain paths to MoveFileExW. #1285 also touches RPF extraction filenames, but it bounds their length rather than prefixing the commit path.
move_path makes the path absolute and adds \\?\ or \\?\UNC\ only from 260 characters on, and leaves verbatim and device paths alone. That matches MoveFileExW's MAX_PATH limit. The end-to-end test builds a path over 300 characters. No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

@Foniass

Foniass commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

merge-check
base: 1c8b551
head: 6de9cf7
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2911 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (+68/-2). atomic_write_with now gives MoveFileExW absolute paths and adds \\?\ / \\?\UNC\ from 260 UTF-16 units on, so xcl rpf --extract can commit a record into a deep output folder. Findings: (1) The same plain-path move remains in the pipeline library. shaders/pipeline_library.rs ~146 on main builds its MoveFileExW paths the same way, and the description's Not tested names only XGameSave (#922) as another caller; that belongs in a separate PR and doesn't block this one. Fine: std::path::absolute returns a verbatim path unchanged and otherwise normalises it through GetFullPathNameW before the length check, so the prefixed path is already clean; the 259 / 260 edge matches MAX_PATH with its NUL; \\.\ and \\?\UNC\ paths aren't prefixed twice; with no longPathAware manifest in the crate, atomic_write_commits_past_max_path fails without the change; it merges cleanly into main and alongside #1285 (which bounds the temporary name instead); no other PR makes this change; the smoke title doesn't reach xcl rpf, as the description says.
performance: 60 s smoke of a retail title, main 1c8b551 vs this merge (09f3db83): 1652 -> 1673 frames shown (101 %; last presents per 2 s: 60 60 60), peak commit 18228 -> 19182 MB, 0 device removals, 0 crashes. The smoke title doesn't reach xcl rpf, so the run is a regression check only.
verdict: safe to merge: the fix is correct, its test (atomic_write_commits_past_max_path) passes here, the suite passes and the smoke run is clean; the same plain-path move in the pipeline library is a separate PR
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

AI-written and posted by Foniass without a human check of each point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

checks-disagree Merge-checks disagree (safe vs not yet); needs maintainer/3rd look

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants