eza icon indicating copy to clipboard operation
eza copied to clipboard

bug: hardlinks are counted as individual files

Open thingsiplay opened this issue 10 months ago • 1 comments

System Information

  • The version of eza being used (eza --version)
$ eza --version
eza - A modern, maintained replacement for ls
v0.18.9 [+git]
https://github.com/eza-community/eza
  • The command-line arguments you are using
-l --total-size --no-permissions --no-user ./trampoline
  • Your operating system and hardware platform

If it’s a crash, please include the full text of the crash that gets printed to the screen. If you’re seeing unexpected behaviour, a screenshot of the issue will help a lot.

$ fastfetch --logo none --gpu-format '{2} [{6}] {3}' --gpu-force-vulkan
OS: EndeavourOS x86_64
Kernel: 6.8.4-zen1-1-zen
Uptime: 9 hours, 34 mins
Packages: 1562 (pacman), 14 (flatpak)
Shell: bash 5.2.26
Display (AG271QG): 2560x1440 @ 120Hz
DE: KDE Plasma 6.0.3
WM: KWin (Wayland)
WM Theme: Breeze
Theme: Breeze (Dark) [QT], Breeze-Dark [GTK2], Breeze [GTK3/4]
Icons: breeze-dark [QT], breeze-dark [GTK2/3/4]
Font: NotoSans Nerd Font (12pt) [QT], NotoSans Nerd Font (12pt) [GTK2/3/4]
Cursor: breeze (24px)
Terminal: konsole 24.2.1
Terminal Font: JetBrainsMono Nerd Font Mono (11pt)
CPU: AMD Ryzen 7 7700X (16) @ 5,57 GHz
GPU 1: AMD Radeon RX 7600 (RADV NAVI33) [Discrete] Mesa 24.0.4-arch1.2
GPU 2: AMD Radeon Graphics (RADV RAPHAEL_MENDOCINO) [Integrated] Mesa 24.0.4-arch1.2
Memory: 5,05 GiB / 30,50 GiB (17%)
Swap: 12,00 MiB / 512,00 MiB (2%)
Disk (/): 456,55 GiB / 1,79 TiB (25%) - ext4
Disk (/media/Emulation): 4,72 TiB / 5,41 TiB (87%) - ext4
Disk (/media/My): 1,76 TiB / 3,58 TiB (49%) - ext4
Disk (/media/Work): 442,32 GiB / 915,82 GiB (48%) - ext4
Local IP (eno1): 192.168.1.242/24 *
Locale: en_US.UTF-8

The problem

Today I noticed a discrepancy in the output of total folder sizes, compared to other programs. eza had way too high numbers for some folders. As comparison I looked at the filemanager Dolphin (properties with right mouse click) and with commandline tool:

du --human-readable --apparent-size --all --max-depth 1 ./trampoline

with and without --si option. The 1000 vs 1024 base of bit counting is not the issue here. After some digging into my files and folders and comparing stuff, I found out that for hardlink files eza counts them individually. But that is wrong, because those files exist only once on the drive and require the space only once. ls can show the number of hardlinks each file has:

$ \ls -l
total 9404
-rwxr-xr-x 2 tuncay tuncay 4810688  5. Apr 10:47 build-script-main
-rwxr-xr-x 2 tuncay tuncay 4810688  5. Apr 10:47 build_script_main-947fc87152b779c9
-rw-r--r-- 1 tuncay tuncay    2298  5. Apr 10:47 build_script_main-947fc87152b779c9.d

The 2 is the number of hardlinks for the same file.

thingsiplay avatar Apr 07 '24 18:04 thingsiplay

Approved, here LS example, err file is main, err_hl is hardlink to err, but it daznt show properly

HardLink-Broken

Kol9yN avatar May 20 '24 20:05 Kol9yN