Mola-maker commented on code in PR #9032:
URL: https://github.com/apache/opendal/pull/9032#discussion_r4683609659
##########
core/services/fs/src/core.rs:
##########
@@ -466,6 +471,52 @@ fn parse_conditional_rename_directory_error(
.with_context("service_operation", "Rename")
}
+/// Re-check `path` after a failed filesystem call so that Windows reports the
+/// same error kinds as Unix.
+///
+/// Windows reports a directory target as `ERROR_ACCESS_DENIED`, and a regular
+/// file in a parent component as `ERROR_PATH_NOT_FOUND` or, from
+/// `create_dir_all`, `ERROR_ALREADY_EXISTS`. Unix reports these as `EISDIR`
+/// and `ENOTDIR`. The original error is kept as the source.
+pub(crate) async fn refine_path_error(err: std::io::Error, path: &Path) ->
std::io::Error {
Review Comment:
Good catch, the doc comment is unclear. The failed call is not retried.
Windows reports these cases with error codes that do not say what the path is.
The metadata call is a read-only probe after the failure. It only tells us
whether the path is a directory, or whether an ancestor is a file. That lets us
map the error to IsADirectory or NotADirectory. The original error is kept as
the source. I updated the doc comment to say this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]