Mac: Check the return value of stat in PrjFS_DeleteFile#1018
Conversation
|
@kewillford I noticed this issue when looking at the logs for your #1014 PR. I noticed this was getting logged a lot in your test run (as well as successful test runs) and the noise of this getting logged all of the time made it difficult to understand if there was a problem. |
| switch(errno) | ||
| { | ||
| case ENOENT: // A component of fullPath does not exist | ||
| case ENOTDIR: // A component of fullPath is not a directory |
There was a problem hiding this comment.
Do you know when it would hit this case? How does that stat know that you are looking for a directory? What if this was called for a file? I don't think in VFSForGit we ever do try to delete a file though.
There was a problem hiding this comment.
Do you know when it would hit this case?
I would expect the ENOTDIR case to be hit if you called stat on a path like /a/b/c/d.txt and a/b/c is a file.
How does that stat know that you are looking for a directory?
What if this was called for a file?
stat doesn't know what you're looking for, these errors indicate that the file that you're looking for is not on disk (either because part of the path does not exist, or part of the path is a file).
I don't think in VFSForGit we ever do try to delete a file though.
In VFS4G we delete files when changing to a projection where some of the file placeholders no longer exist.
Fixes #1019
PrjFS_DeleteFileis incorrectly returningPrjFS_Result_EVirtualizationInvalidOperationwhen it's called for files/directories that do not exist.This results in a lot of misleading messages being recorded in the GVFS mount process log files.
Example log message
Prior to this PR the functional tests recorded
RemoveFolderPlaceholderIfEmpty_DeleteFileFailure129 times. With this change the message is not recorded at all during the functional test runs.