Repository navigation
file_system: a move onto an existing GAME: folder reports ERROR_ALREADY_EXISTS (FS-MOVE-ONTO-FOLDER) - #2375
file_system: a move onto an existing GAME: folder reports ERROR_ALREADY_EXISTS (FS-MOVE-ONTO-FOLDER)#2375syfyra 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>
|
Independent verification on this machine (Windows 11, MSVC 19.44.35226), with a negative control that bites on two assertions. 1. It applies. 2. With the branch its test passes: 3. The control - revert only the shim, keep the test: Both failures name the rule the change adds: moving a file onto an existing directory ( One thing I noticed and did not judge: the assertion text uses Why I am commenting: I verify open pull requests that replay onto current Written with an AI assistant. |
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