mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
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:
+7
-7
@@ -28,16 +28,16 @@ pub fn build_node(
|
||||
let use_apparent_size = walk_data.use_apparent_size;
|
||||
let by_filecount = walk_data.by_filecount;
|
||||
|
||||
get_metadata(&dir, use_apparent_size).map(|data| {
|
||||
let inode_device = if is_symlink && !use_apparent_size {
|
||||
None
|
||||
} else {
|
||||
data.1
|
||||
};
|
||||
get_metadata(
|
||||
&dir,
|
||||
use_apparent_size,
|
||||
walk_data.follow_links && is_symlink,
|
||||
)
|
||||
.map(|data| {
|
||||
let inode_device = data.1;
|
||||
|
||||
let size = if is_filtered_out_due_to_regex(walk_data.filter_regex, &dir)
|
||||
|| is_filtered_out_due_to_invert_regex(walk_data.invert_filter_regex, &dir)
|
||||
|| (is_symlink && !use_apparent_size)
|
||||
|| by_filecount && !is_file
|
||||
|| [
|
||||
(&walk_data.filter_modified_time, data.2 .0),
|
||||
|
||||
Reference in New Issue
Block a user