mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
du: Fix double counting of hard links.
hard linked files are no longer counted - this mimcs the behaviour of the original du.
This commit is contained in:
parent
e253406026
commit
b6c7771087
2 changed files with 31 additions and 5 deletions
|
@ -47,10 +47,22 @@ fn test_du_soft_link() {
|
|||
assert_eq!(result.stdout, "32\tsubdir\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_du_hard_link() {
|
||||
let ts = TestScenario::new("du");
|
||||
|
||||
let link = ts.cmd("ln").arg(SUB_FILE).arg(SUB_LINK).run();
|
||||
assert!(link.success);
|
||||
|
||||
let result = ts.ucmd().arg(SUB_DIR).run();
|
||||
assert!(result.success);
|
||||
assert_eq!(result.stderr, "");
|
||||
// We do not double count hard links as the inodes are identicle
|
||||
assert_eq!(result.stdout, "24\tsubdir\n");
|
||||
}
|
||||
|
||||
// todo:
|
||||
// du on file with no permissions
|
||||
// du on soft link
|
||||
// du on hard link
|
||||
// du on multi dir with '-d'
|
||||
//
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue