Skip to content

file_system: a CopyFile2 already cancelled creates nothing in the overlay - #9547

Merged
ItsNotRexed merged 1 commit into
ProjectLeonida:mainfrom
tedin7:c2-fs-copyfile2-cancel-before-parents
Nov 23, 2026
Merged

ItsNotRexed merged 1 commit into
ProjectLeonida:mainfrom
tedin7:c2-fs-copyfile2-cancel-before-parents

Conversation

@tedin7

@tedin7 tedin7 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

What

Check CopyFile2 cancellation before preparing the destination overlay.

Why

An already cancelled copy must not create overlay parent directories.

Tested

  • p2, Wine: file_system_test, origin/main 448 checks / 8 failures; fixed 448 / 6 failures. Both new cancellation checks fail before and pass after; both uncancelled controls pass. Six existing MAXIMUM_ALLOWED failures remain in both runs; two Wine-dependent checks skip. No GPU used.
  • git diff --check; check_no_game_data.py on both changed files.

AI-assisted.

@ItsNotRexed: an exe PR, as you asked.

Claim: #9401 (comment)

@mrbrinker

Copy link
Copy Markdown
Contributor

On Windows Server 2022 x64, the two new overlay tests fail on the parent and pass on 28716dae. The filesystem test executable also exits successfully on the PR. I found a Windows compatibility regression in the new position of the cancellation check.

I set pfCancel to TRUE, called the system CopyFile2 on temporary files, then ran the equivalent cases through the shim. Both shim backends returned the same results.

Input with cancellation already set Native Windows Parent 5d74c272 PR 28716dae
Missing source file (deleted in the overlay case) FILE_NOT_FOUND FILE_NOT_FOUND REQUEST_ABORTED
Existing destination with FAIL_IF_EXISTS FILE_EXISTS FILE_EXISTS REQUEST_ABORTED
Missing destination parent PATH_NOT_FOUND PATH_NOT_FOUND REQUEST_ABORTED

For a valid copy, native Windows returned REQUEST_ABORTED and left the destination absent. Clearing the flag copied all 65,536 bytes. The existing destination also kept its three original bytes in the fail-if-exists case.

Could you split destination validation from directory creation, then check cancellation between them? That would preserve the parent’s three error results and keep your new guarantee that a cancelled copy creates nothing. The comparison uses synthetic files and both the system and forced fallback paths. Windows run and probe output

AI-assisted.

@ddaikodaiko

Copy link
Copy Markdown

Windows check of 28716da: Windows 10 Pro 10.0.19045, MSVC 19.44.35229, Windows SDK 10.0.26100, CMake 3.31 + Ninja. No game files.

cmake --build runtime\build --target file_system_test -j 10
ctest --test-dir runtime\build -R "^file_system$" --output-on-failure
  -> 1/1 Test #51: file_system ... Passed 2.74 sec

The cancelled-CopyFile2 case leaves nothing in the overlay here too.

@sgonzalez-glitch

Copy link
Copy Markdown

Tested 28716daea (as part of #9429, #9505, #9516, #9547, #9549 and #9558 merged together onto main 5d74c2723) on NVIDIA GeForce RTX 2080, driver 621.24 (32.0.16.2124), Windows 11, MSVC 19.44 RelWithDebInfo: pass.

AI-assisted: yes

@ItsNotRexed
ItsNotRexed merged commit 5b12f22 into ProjectLeonida:main Nov 23, 2026
0 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants