fix: retrieve metadata for symbolic links without following them

Previously, the function get_metadata in platform.rs used `fs::metadata` which follows symbolic links
and returns metadata for the target file. This caused issues #421: du / dust disagreement
when trying to determine properties of the symbolic link itself
This commit is contained in:
wugeer
2024-07-28 13:23:18 +08:00
committed by andy.boot
parent dbd18f90e7
commit 733117d0f6
5 changed files with 51 additions and 17 deletions
+1 -1
View File
@@ -228,7 +228,7 @@ fn main() {
let follow_links = options.get_flag("dereference_links");
let allowed_filesystems = limit_filesystem
.then(|| get_filesystem_devices(&target_dirs))
.then(|| get_filesystem_devices(&target_dirs, follow_links))
.unwrap_or_default();
let simplified_dirs = simplify_dir_names(&target_dirs);