[PR #422] [MERGED] fix: retrieve metadata for symbolic links without following them #479

Closed
opened 2026-06-08 11:28:39 +03:00 by zhus · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bootandy/dust/pull/422
Author: @wugeer
Created: 7/28/2024
Status: Merged
Merged: 7/31/2024
Merged by: @bootandy

Base: masterHead: feature_fix_soft_link_size_new


📝 Commits (1)

  • f661793 fix: retrieve metadata for symbolic links without following them

📊 Changes

5 files changed (+51 additions, -17 deletions)

View changed files

📝 src/dir_walker.rs (+13 -3)
📝 src/main.rs (+1 -1)
📝 src/node.rs (+7 -7)
📝 src/platform.rs (+14 -2)
📝 src/utils.rs (+16 -4)

📄 Description

Background

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 https://github.com/bootandy/dust/issues/421: du / dust disagreement when trying to determine properties of the symbolic link itself

Full Changelogs

  • fix: retrieve metadata for symbolic links without following them

Issue Reference

du / dust disagreement: https://github.com/bootandy/dust/issues/421

Test Result

cargo test command output

image

du -s output vs cargo run -- -ok /home/shirley/code/python/official/superset/superset-frontend

image

du -s -L output vs cargo run -- -ok -L /home/shirley/code/python/official/superset/superset-frontend

image

while use dust v1.0.0 command,
image

image

The output shows that dust v1.0.0 produces the same results regardless of whether the -L parameter is used. That disagrees with du command.

performance test results

image
image

image
image


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bootandy/dust/pull/422 **Author:** [@wugeer](https://github.com/wugeer) **Created:** 7/28/2024 **Status:** ✅ Merged **Merged:** 7/31/2024 **Merged by:** [@bootandy](https://github.com/bootandy) **Base:** `master` ← **Head:** `feature_fix_soft_link_size_new` --- ### 📝 Commits (1) - [`f661793`](https://github.com/bootandy/dust/commit/f6617937e1869b06d92a140e137f181ccd5622fa) fix: retrieve metadata for symbolic links without following them ### 📊 Changes **5 files changed** (+51 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `src/dir_walker.rs` (+13 -3) 📝 `src/main.rs` (+1 -1) 📝 `src/node.rs` (+7 -7) 📝 `src/platform.rs` (+14 -2) 📝 `src/utils.rs` (+16 -4) </details> ### 📄 Description # Background 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 https://github.com/bootandy/dust/issues/421: **du / dust disagreement** when trying to determine properties of the symbolic link itself # Full Changelogs - fix: retrieve metadata for symbolic links without following them # Issue Reference du / dust disagreement: https://github.com/bootandy/dust/issues/421 # Test Result cargo test command output ![image](https://github.com/user-attachments/assets/c3bb1e88-8475-4e33-99a7-5e542569aa72) du -s output vs cargo run -- -ok /home/shirley/code/python/official/superset/superset-frontend ![image](https://github.com/user-attachments/assets/cc8d9007-a484-4bc7-9df9-c75a527b5f3f) du -s -L output vs cargo run -- -ok -L /home/shirley/code/python/official/superset/superset-frontend ![image](https://github.com/user-attachments/assets/df64cb9a-d601-4e02-af51-bc30a57b6366) while use dust v1.0.0 command, ![image](https://github.com/user-attachments/assets/4bd80680-f768-4ff9-833a-fe66bd131027) ![image](https://github.com/user-attachments/assets/3825637f-80a7-471f-aedc-7b3cc91a3fd6) The output shows that dust v1.0.0 produces the same results regardless of whether the -L parameter is used. That disagrees with du command. # performance test results ![image](https://github.com/user-attachments/assets/46e8ba96-9913-4ddd-8e10-54d36960eb75) ![image](https://github.com/user-attachments/assets/4535537f-ee9f-48b7-8885-4ae79689896c) ![image](https://github.com/user-attachments/assets/c8199c74-06e1-4d80-9819-112deb0a1579) ![image](https://github.com/user-attachments/assets/491f9a41-2b99-4a2b-aed5-10b807cb3306) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
zhus added the pull-request label 2026-06-08 11:28:39 +03:00
zhus closed this issue 2026-06-08 11:28:41 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bootandy/archived-dust#479