tustvold commented on code in PR #2195:
URL: https://github.com/apache/arrow-rs/pull/2195#discussion_r931577798
##########
object_store/src/local.rs:
##########
@@ -804,11 +804,36 @@ fn convert_metadata(metadata: std::fs::Metadata,
location: Path) -> Result<Objec
}
/// Convert walkdir results and converts not-found errors into `None`.
+/// Convert broken symlinks to `None`.
fn convert_walkdir_result(
res: std::result::Result<walkdir::DirEntry, walkdir::Error>,
) -> Result<Option<walkdir::DirEntry>> {
match res {
- Ok(entry) => Ok(Some(entry)),
+ Ok(entry) => {
+ // To check for broken symlink: call symlink_metadata() - it does
not traverse symlinks);
+ // if ok: check if entry is symlink; and try to read it by calling
metadata().
+ match symlink_metadata(entry.path()) {
Review Comment:
I wonder if we should invert the order here, to optimise for the common case
of non-broken symlinks.
i.e. call `std::fs::metadata` if this fails with `ErrorKind::NotFound`, then
call `symlink_metadata` to check if it is a broken symlink we should just
ignore?
--
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]