Repository navigation
file_system: a move onto an existing GAME: folder reports ERROR_ALREADY_EXISTS (FS-MOVE-ONTO-FOLDER) - #2375
Draft
syfyra wants to merge 1 commit into
Draft
file_system: a move onto an existing GAME: folder reports ERROR_ALREADY_EXISTS (FS-MOVE-ONTO-FOLDER)#2375syfyra wants to merge 1 commit into
syfyra wants to merge 1 commit into
Conversation
…DY_EXISTS (FS-MOVE-ONTO-FOLDER) MoveFileEx onto a folder failed with ERROR_ACCESS_DENIED whatever the flags. The host reports any existing destination, a folder too, as ERROR_ALREADY_EXISTS without MOVEFILE_REPLACE_EXISTING, and ERROR_ACCESS_DENIED only with it (measured on Windows 11 for a file and a folder source, onto an empty and a non-empty folder). A title that checks for ERROR_ALREADY_EXISTS to decide to clear the way first now gets it. MoveFileW, which passes no replace flag, follows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: FS-MOVE-ONTO-FOLDER
What and why
MoveFileExWon console paths refused a move onto an existing folder withERROR_ACCESS_DENIED, whatever the flags. The host only does that withMOVEFILE_REPLACE_EXISTING. Without it, any existing destination, a folder included, is "already there". Measured on Windows 11 with a small probe on an NTFS temp folder:COPY_ALLOWEDREPLACE_EXISTING(with or withoutCOPY_ALLOWED)ERROR_ALREADY_EXISTSERROR_ACCESS_DENIEDA title that checks for
ERROR_ALREADY_EXISTSto clear the way first and move again gotERROR_ACCESS_DENIEDinstead.MoveFileW, which passes no replace flag, has the same problem.The shim now reports any existing destination as
ERROR_ALREADY_EXISTSwhenMOVEFILE_REPLACE_EXISTINGis not set, and a folder asERROR_ACCESS_DENIEDwhen it is. Nothing else changes. One case still differs from the host, as before this change: the host letsMOVEFILE_REPLACE_EXISTINGmove a folder over an existing file, and the shim keeps refusing that withERROR_ACCESS_DENIED.Tested
Windows 11, MSVC 14.44 (Build Tools), RelWithDebInfo:
file_system_testgets checks in its MoveFile block. A package file is moved onto a package folder (GAME:\data\sub) and onto an overlay folder (GAME:\cache\renamed) withMoveFileExW(0),MoveFileWandMoveFileExW(MOVEFILE_REPLACE_EXISTING), then an overlay folder onto a package folder. The checks confirm that the file and the folder stay where they were.main: 5 of the new checks fail (each one that expectsERROR_ALREADY_EXISTS).file_system.cppor its test (checked withscripts/pr_overlap.pyfrom scripts: pr_overlap.py lists the open pull requests that change the same files (PR-OVERLAP-CHECK) #2349). The six it lists as conflicting already conflict withmain, and none of them touches these lines.scripts/check_no_game_data.pyon both files.Not tested under Wine.
GPUs tested: n/a (CPU tests)
AI-assisted: yes (Claude Code, Claude Opus 5.5)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code