From e36b65a11a7fa72e4b43f89c71441884269f0522 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Thu, 1 Feb 2018 21:11:02 -0500 Subject: windows: fix OneDrive traversals This commit fixes a bug on Windows where directory traversals were completely broken when attempting to scan OneDrive directories that use the "file on demand" strategy. The specific problem was that Rust's standard library treats OneDrive directories as reparse points instead of directories, which causes methods like `FileType::is_file` and `FileType::is_dir` to always return false, even when retrieved via methods like `metadata` that purport to follow symbolic links. We fix this by peppering our code with checks on the underlying file attributes exposed by Windows. We consider an entry a directory if and only if the directory bit is set on the attributes. We are careful to make sure that the code remains the same on non-Windows platforms. Note that we also bump the dependency on `walkdir`, which contains a similar fix for its traversals. This bug is recorded upstream: https://github.com/rust-lang/rust/issues/46484 Upstream also has a pending PR: https://github.com/rust-lang/rust/pull/47956 Fixes #705 --- ignore/Cargo.toml | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ignore/Cargo.toml') diff --git a/ignore/Cargo.toml b/ignore/Cargo.toml index b2c86778..89d8672c 100644 --- a/ignore/Cargo.toml +++ b/ignore/Cargo.toml @@ -28,6 +28,10 @@ same-file = "1" thread_local = "0.3.2" walkdir = "2" +[target.'cfg(windows)'.dependencies.winapi] +version = "0.3" +features = ["std", "winnt"] + [dev-dependencies] tempdir = "0.3.5" -- cgit v1.2.3