summaryrefslogtreecommitdiffstats
path: root/src/traverse.rs
diff options
context:
space:
mode:
authorSebastian Thiel <sebastian.thiel@icloud.com>2020-03-27 21:26:23 +0800
committerSebastian Thiel <sebastian.thiel@icloud.com>2020-03-27 21:26:23 +0800
commit768cbce3963be7d6ece448d56289223810d678ac (patch)
treef56cb2355ad058c7a228b70505ffd1eb440698c7 /src/traverse.rs
parent2bbbb0b42371e0701af3b927fee129cd8be5a852 (diff)
Truly don't follow symlinks unless they are the only top-level path.v2.3.9
This is a brute-force hack which won't show them at all, there certainly is better ways if we would know if we expanded paths ourselves or not.
Diffstat (limited to 'src/traverse.rs')
-rw-r--r--src/traverse.rs21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/traverse.rs b/src/traverse.rs
index a332088..c971bd1 100644
--- a/src/traverse.rs
+++ b/src/traverse.rs
@@ -78,7 +78,16 @@ impl Traversal {
// Also means that we will spin up a bunch of threads per root path, instead of reusing them.
walk_options.threads = num_cpus::get();
}
+ let input_len = input.len();
for path in input.into_iter() {
+ // For now, bluntly ignore symlinks that are on the top-level, and there are more roots to follow
+ if input_len > 1 {
+ if let Ok(meta) = path.symlink_metadata() {
+ if meta.file_type().is_symlink() {
+ continue;
+ }
+ }
+ }
let mut last_seen_eid = 0;
for (eid, entry) in walk_options
.iter_from_path(path.as_ref())
@@ -102,13 +111,11 @@ impl Traversal {
if walk_options.apparent_size {
m.len()
} else {
- data.name.size_on_disk_fast(m).unwrap_or_else(
- |_| {
- t.io_errors += 1;
- data.metadata_io_error = true;
- 0
- },
- )
+ data.name.size_on_disk_fast(m).unwrap_or_else(|_| {
+ t.io_errors += 1;
+ data.metadata_io_error = true;
+ 0
+ })
}
}
Some(Ok(_)) => 0,