You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
du: double-counting hard links when multiple arguments specified #10241
If a number of directories share hard links (such as backups), du will count these twice if these directories are specified as multiple arguments. In the GNU implementation, du would consider hard links only once if multiple arguments that shared them were supplied.
Reproduce
Create two directories backup_1 and backup_2
mkdir backup_1 backup_2
Populate backup_1 with a file
dd if=/dev/urandom count=256 of=backup_1/file
Create a hard-link of file in backup_2
ln backup_1/file backup_2/
Verify directory sizes individually
# Both directories should be of size 132K when measured individually, depending on directory block size# - Directory Block Size: 4K# - Size of file: 128K (default dd block size is 512 -> 256 * 512 = 128K)
$ du -h backup_1
132K backup_1
$ du -h backup_2
132K backup_2
Verify directory sizes together
# When measured together we would expect these sizes, depending on directory block size# - backup_1: 132K (4K + 128K)# - backup_2: 4K (file is accounted for in backup_1)
$ du -h backup_1 backup_2
132K backup_1
132K backup_2 # <- file got measured twice here
$ gnudu -h backup_1 backup_2
132K backup_1
4.0K backup_2 # <- GNU implementation accounts for this
System
OS release: Ubuntu 26.04 (Development branch)
uutils coreutils version: 0.5.0 (built from main commit: 1d6bd99)
Very trivial fix here, need to add an integration test. The vec for tracking the files that have been seen was being overwritten every loop and just needs to be instantiated outside of the loop.
The pull request #10313 with the fix was merged in commit 8d02762 in 19 Jan 2026. It seems this fix was included in the release 0.6.0, based on the output of this command:
However, the version of du shipped by Ubuntu 25.10 seems to be 0.2.2, so this fix has not yet been released in Ubuntu 25.10:
$ du --version
du (uutils coreutils) 0.2.2
This matches my experience using du (uutils) on Ubuntu 25.10. I still experience this bug, despite updating all my packages on Ubuntu 25.10. I'm leaving this comment here, for anyone else experiecing this bug. I will comment on the Launchpad bug, and I will ask that the bug report be reopened in Launchpad.
Activity
ChrisDryden commentedon Jan 15, 2026
Very trivial fix here, need to add an integration test. The vec for tracking the files that have been seen was being overwritten every loop and just needs to be instantiated outside of the loop.
ChrisDryden commentedon Jan 19, 2026
Fixed with #10313
Flimm commentedon Feb 25, 2026
The pull request #10313 with the fix was merged in commit 8d02762 in 19 Jan 2026. It seems this fix was included in the release 0.6.0, based on the output of this command:
However, the version of
dushipped by Ubuntu 25.10 seems to be 0.2.2, so this fix has not yet been released in Ubuntu 25.10:This matches my experience using
du(uutils) on Ubuntu 25.10. I still experience this bug, despite updating all my packages on Ubuntu 25.10. I'm leaving this comment here, for anyone else experiecing this bug. I will comment on the Launchpad bug, and I will ask that the bug report be reopened in Launchpad.