From unknown Tue Aug 19 04:06:42 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#39092 <39092@debbugs.gnu.org> To: bug#39092 <39092@debbugs.gnu.org> Subject: Status: Bug in coreutils "du"? - ignores files when both a file and a hard link is given Reply-To: bug#39092 <39092@debbugs.gnu.org> Date: Tue, 19 Aug 2025 11:06:42 +0000 retitle 39092 Bug in coreutils "du"? - ignores files when both a file and a= hard link is given reassign 39092 coreutils submitter 39092 Alex severity 39092 normal tag 39092 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 11 13:16:15 2020 Received: (at submit) by debbugs.gnu.org; 11 Jan 2020 18:16:15 +0000 Received: from localhost ([127.0.0.1]:56661 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iqLJ1-0006UX-2M for submit@debbugs.gnu.org; Sat, 11 Jan 2020 13:16:15 -0500 Received: from lists.gnu.org ([209.51.188.17]:53234) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iqKVQ-00055T-0s for submit@debbugs.gnu.org; Sat, 11 Jan 2020 12:25:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46273) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iqKVO-0005hQ-ES for bug-coreutils@gnu.org; Sat, 11 Jan 2020 12:24:59 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iqKVN-0002Ky-4W for bug-coreutils@gnu.org; Sat, 11 Jan 2020 12:24:58 -0500 Received: from mail.vds-host.org ([95.216.255.123]:58038) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iqKVM-000262-Jq for bug-coreutils@gnu.org; Sat, 11 Jan 2020 12:24:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=rakul.info; s=mail; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Date:Message-ID:To:Subject:From; bh=+jO+G/ZehIwxP5o4PYsNUkXyuP9TB7KQAPPJ3DI21R4=; b=VY4xwDWiBzvJNKVEjWU4+dRqlDX4sO7J4VEnjifALXSy/9ivl9nFQbKgOa2/zB6AOTcSko32hNRdJdM4RH3dQuhXmLOB4Uasdvfxy9frMCfbPIR8kFBF30uIU8dzUmDOgUbGz67/Rk0wMrc0lODW0d4aNl5fL7u2ouq8abjab63f1NCBg6dBcbmhAs35wAmTegiLQX5CMHbX12VXECQ+0Wsmy3IbceyLvWUW79P1qbqLphPBMBwuHKyNPij1TKf6yaxyC1Q0FCrgSI2x2s9Za86fusvm3DDzLesH6r5ozDf6bV5RfupmW4nL+/PkKJ0egLFg0qtDaPzOk4s00SQEKA==; Received: from [5.18.96.48] (helo=[192.168.0.23]) by mail.vds-host.org with esmtpa (Exim 4.80) (envelope-from ) id 1iqKV9-0004km-5W for bug-coreutils@gnu.org; Sat, 11 Jan 2020 20:24:43 +0300 From: Alex Subject: Bug in coreutils "du"? - ignores files when both a file and a hard link is given To: bug-coreutils@gnu.org Message-ID: <437dfb69-3801-d1d2-df5d-6a10934b4fdb@rakul.info> Date: Sat, 11 Jan 2020 20:23:59 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 95.216.255.123 X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 11 Jan 2020 13:16:14 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) Hi guys, I noticed that when I explicitly specify a file and a hardlink to that file as du's command line arguments it ignores both of them. Here "kernel", "initramfs" and "System.map" are hardlinks to kernel-genkernel-x86_64-5.4.2-gentoo, initramfs-genkernel-x86_64-5.4.2-gentoo and System.map-5.4.10-gentoo-x86_64. 19:56:45 [0] ~ >ls -la /boot/ total 72281 drwxr-xr-x  5 root root     1024 Jan 11 19:49 . drwxr-xr-x 22 root root     4096 Dec  7 21:00 .. -rw-r--r--  1 root root        0 Jan  8 23:58 .e.mount -rw-r--r--  1 root root        0 Jan  8 23:58 .keep -rw-r--r--  2 root root  3456397 Jan  9 21:48 System.map -rw-r--r--  1 root root  3474911 Dec  6 20:22 System.map-5.3.5-gentoo-x86_64 -rw-r--r--  1 root root  3473259 Jan 11 19:49 System.map-5.4.10-gentoo-x86_64 -rw-r--r--  2 root root  3456397 Jan  9 21:48 System.map-genkernel-x86_64-5.4.2-gentoo drwxr-xr-x  2 root root     1024 Apr 29  2019 efi drwxr-xr-x  7 root root     1024 Jan  9 22:50 grub -rw-r--r--  2 root root  8196820 Jan  9 22:15 initramfs -rw-r--r--  1 root root 16531780 Oct  9 21:35 initramfs-5.3.5-gentoo-x86_64.img -rw-r--r--  2 root root  8196820 Jan  9 22:15 initramfs-genkernel-x86_64-5.4.2-gentoo -rw-r--r--  2 root root  6804640 Jan  9 21:48 kernel -rw-r--r--  2 root root  6804640 Jan  9 21:48 kernel-genkernel-x86_64-5.4.2-gentoo drwx------  2 root root    12288 Apr 29  2019 lost+found -rw-r--r--  1 root root  6759584 Dec  6 20:22 vmlinuz-5.3.5-gentoo-x86_64 -rw-r--r--  1 root root  6829216 Jan 11 19:49 vmlinuz-5.4.10-gentoo-x86_64 As you can see they are missing from du output: 19:56:48 [0] ~ >sudo du -hs /boot/System.map /boot/System.map-5.3.5-gentoo-x86_64 /boot/System.map-genkernel-x86_64-5.4.2-gentoo /boot/efi /boot/grub /boot/initramfs /boot/initramfs-5.3.5-gentoo-x86_64.img /boot/initramfs-genkernel-x86_64-5.4.2-gentoo /boot/kernel /boot/kernel-genkernel-x86_64-5.4.2-gentoo /boot/lost+found /boot/vmlinuz-5.3.5-gentoo-x86_64 3.3M    /boot/System.map 3.4M    /boot/System.map-5.3.5-gentoo-x86_64 1.0K    /boot/efi 9.7M    /boot/grub 7.9M    /boot/initramfs 16M    /boot/initramfs-5.3.5-gentoo-x86_64.img 6.5M    /boot/kernel 12K    /boot/lost+found 6.5M    /boot/vmlinuz-5.3.5-gentoo-x86_64 When I remove the hard link from the arguments the corresponding file appears in the output: 19:56:51 [0] ~ >sudo du -hs /boot/System.map /boot/System.map-5.3.5-gentoo-x86_64 /boot/System.map-genkernel-x86_64-5.4.2-gentoo /boot/efi /boot/grub /boot/initramfs /boot/initramfs-5.3.5-gentoo-x86_64.img /boot/initramfs-genkernel-x86_64-5.4.2-gentoo /boot/kernel-genkernel-x86_64-5.4.2-gentoo /boot/lost+found /boot/vmlinuz-5.3.5-gentoo-x86_64 3.3M    /boot/System.map 3.4M    /boot/System.map-5.3.5-gentoo-x86_64 1.0K    /boot/efi 9.7M    /boot/grub 7.9M    /boot/initramfs 16M    /boot/initramfs-5.3.5-gentoo-x86_64.img 6.5M    /boot/kernel-genkernel-x86_64-5.4.2-gentoo 12K    /boot/lost+found 6.5M    /boot/vmlinuz-5.3.5-gentoo-x86_64 19:57:28 [0] ~ > Cheers, Alex. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 12 10:11:52 2020 Received: (at 39092) by debbugs.gnu.org; 12 Jan 2020 15:11:52 +0000 Received: from localhost ([127.0.0.1]:57784 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iqeu7-0003ou-To for submit@debbugs.gnu.org; Sun, 12 Jan 2020 10:11:52 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:42845) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iqeu5-0003ob-HX; Sun, 12 Jan 2020 10:11:50 -0500 Received: from [192.168.101.10] ([93.218.97.181]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MqbDs-1jULIl19yC-00mfXZ; Sun, 12 Jan 2020 16:11:43 +0100 Subject: Re: bug#39092: Bug in coreutils "du"? - ignores files when both a file and a hard link is given To: 39092@debbugs.gnu.org References: <437dfb69-3801-d1d2-df5d-6a10934b4fdb@rakul.info> From: Bernhard Voelker Autocrypt: addr=mail@bernhard-voelker.de; prefer-encrypt=mutual; keydata= mQENBFPirzMBCACyzYldTjQ4ufFOkByY5Nn5USb5GFoL48nWBwNHjd9KUbtRRNlQiPNKd6hK Gvd3BGi5aoFKA4ytfRk6jbAbW3jVb3R8wYaV08mOy4KVEKxqN4bxsXlMjNChXVR+rtKDmfI+ oPTL+cPH2X6gW4W02IRbVw0uUhNm6zEedC/gNrY/mTlf1enZ46jxZ7BTUZaG+kx38UMISIMB zSzLRtdkwgmHj4jS3p1fF2cwRqLclIfMjKGpbNFPEXeXKWrCLcqHw78795eAR9q0YvrDkfIn GdDBwfb3VM4NdulwIFzvYZMSXvSbbyPLB5YkHU5aAWQHUse4WlfT5ccDpbzUYldRAvF9ABEB AAG0K0Jlcm5oYXJkIFZvZWxrZXIgPG1haWxAYmVybmhhcmQtdm9lbGtlci5kZT6JATkEEwEC ACMFAlPirzMCGwMHCwkIBwMCAQYVCAIJCgsEFgIDAQIeAQIXgAAKCRBGUC73lpFxle5wCACC dbs0QaJ0vR3Sff2cKdTk41rUq3YfWngsR///IOU0C5DdkePmCnJE/lUsUy0LRTxcUDLxQR+x QHU8ssRT0JUO9726dI3miy36UdsgmBYaOtLvQcidGmW1R7o0PYYf04+TFtyqKgngOUBPpMgR 6o4UsQxy/OD4bN1WDqOgIjL+D/qJpkKmgp6L6+hhaBCpiOFKRmmV7YyQ3SqVlfQNiHs5ZtkR nXpIjgZARV+GllKucI17bO0CGmTJZ1tstVy0+W3DQT1lbBkTTc++5LONM99D3jjn23l1ocOp folR53F7I4cb2RNfT23v1I59RH37lB9wMOqrKj0UjYAC2YoPGQ3BuQENBFPirzMBCADXLWWp QihBldY6reca8ZKdc3T9qXEOa3akE3DWKztIBmNJhtYOjmpLYajQTkGa7UoJTnbmZE2Rn6ZE oNnvb0gcFNAIcY95KOI+bjOR8HEgh4cx2REXh6L6olIgyXqt/KFusE4wtVZAFxZl+30HzN6n D+1HvrjXxPJRX6MsIYOYyyX9/6OofwJK6QHODYGp8WL2olHDnmsXg4AT6Wlr7qKpKrQELlcF R4xkvdmgL/Ghw/tK0yJTxMIcewCCZWLPOXRmFRbvAadZWPAgVsJ63siNyUlVnVMSzDgTJl+s l/DMabXpqrJQx3/1Yy6mTaDs3XZT/wmBKaTLXx/LByaPxQQ7ABEBAAGJAR8EGAECAAkFAlPi rzMCGwwACgkQRlAu95aRcZWVPwgAqZT6iTXkoP37wYb41323RzhBcJ8JSk4cyBDBUXX0lMrM 3qhiClKG7phpxVdu817Gwc6Hsecg7FfjQAV8MHQ0ZFeEFdk3b2rKBqfsStc+h49/xF3Fb+if CzR9qeQF82fMSxkg18++7hMcHCMO/hPZ/Q0xRi+lrSr2QKDJQuLzSyVU14TxrCkevZjEhtma VNvcJlJzCbiBXee9Fpc5jITUXPFG8E8dxqo1n+duOyIMgozrAnzP7X5V/Ob/Ozf/aGGX9+Jd inyfCX18nWcHALKMU/36Eua/ylalf/2c2YkBp9KCLVmGgPkUgW52EeRPgroIsiwu+rwCSV6Z UyCJ+OymCg== Message-ID: Date: Sun, 12 Jan 2020 16:11:42 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <437dfb69-3801-d1d2-df5d-6a10934b4fdb@rakul.info> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:GEMP1mRTkMNFMS9n7TKUk/nPmYffz9yFt1VO6EroJPme1hm4wSU WZwgEh72Wb+EUG5r0VSLM+xpTE1VON6kGRifam4IBo+kZRth/rHmtuwgilK5XExh5B2cydg KU8hl3oL//a0BP68iKbimFIY44IYbkTscv2RuHlzF0V0Yg+i+qzjH4vFRw5zUgHZ9qzmo+8 8wq5zGjwfSLe1NcgsnUJA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:bOA/0BwpRsw=:zd9dwc1++Zh30h6W9gsDeY M+CzFBQNKLvGev4Cuq2Vfh2UCMSTRmP4FOKnr4t3DYMwRKedRKHQ0sUlIOrEiuxslkh0bvP9l TJiRPyi+n3Pr80bmKpX/wJWAlzJE4DVJ79jafnrTaqWMRWi6C3VGMmIz7j4lYnunz7Zo3o+eP 0aMXQ3eZg/2Gp0rAl0P9ltjaf0GTgJ+tqfLPTExY2gDNzpjAfxpOx5sSwK/dwOr0N9RUl6bGv /vxGWsQsY8N5Bf2F5f4NWVnegutDY5Um+ezMmHCO07CxSHYRT8Zvrzbm7ktco5tCSaoiBsENF FY4ponnAZ8IPuVyhUHGiU0M0eHMXogVjLyiktazzCguPvdR12VG3kM6PdV2qqFLAd7qM55C+P eqPBKfMtbWLiGmeyxtKKi5qFJCnOIzxp2/xOTkycCbypEab4qfHyyhiWMWcY5wGWXqfrJazHr ORwbtdRT3B+HHD6szoKax5EpWhRB5Tm88GvW5vDCsMB4RijB26aVlYsw+ouvZ4LtKUorGoBvU f3t5c2sSxfcjx/Qb6OYH+RJVmz1YEoPD4bKQlGI1i9+YxbhfUr1EzMvBpVO8ee+q5IL1E4/7k m3tKuZD7fUQ5+4MHalJPDC3rz3A4rAhG9qUXx27qzazkEX0RWG6XZS/+SxIpDxNH8eNyz4Iya oMt4MmW+cmKXbWb7Ce2jn+/efSngcaO16qMX9q4goXJfsyHqBJ5wUM78IdU21N54E1/IiiE+F XFsh1p3Nj71Q91rn1+BI26tb8vfZlZgdfdGOA+msbX9b5c9jPc9HkssEqOa2WU7GUBwTxmvyZ 6gYR0oIyZudFekRKB+rUxsxH5Kg3jDcFMjVXjtGxMjItyLEhZwDH4PgXcTQaQeZayocljUNm3 i5o8iocpWCNax0CqrUboWti3HegnrrYYgkMhOwgX0= X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39092 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tag 39092 notabug close 39092 stop I had to take out your email address to be able to reply to this issue: An error occurred while sending mail. The mail server responded: Requested action not taken: mailbox unavailable invalid DNS MX or A/AAAA resource record. Please check the message recipient "me@rakul.info" and try again. On 2020-01-11 18:23, Alex wrote: > Hi guys, > > I noticed that when I explicitly specify a file and a hardlink to that > file as du's command line arguments it ignores both of them. Here > "kernel", "initramfs" and "System.map" are hardlinks to > kernel-genkernel-x86_64-5.4.2-gentoo, > initramfs-genkernel-x86_64-5.4.2-gentoo and System.map-5.4.10-gentoo-x86_64. > > > 19:56:45 [0] ~ >ls -la /boot/ > total 72281 > drwxr-xr-x  5 root root     1024 Jan 11 19:49 . > drwxr-xr-x 22 root root     4096 Dec  7 21:00 .. > -rw-r--r--  1 root root        0 Jan  8 23:58 .e.mount > -rw-r--r--  1 root root        0 Jan  8 23:58 .keep > -rw-r--r--  2 root root  3456397 Jan  9 21:48 System.map > -rw-r--r--  1 root root  3474911 Dec  6 20:22 System.map-5.3.5-gentoo-x86_64 > -rw-r--r--  1 root root  3473259 Jan 11 19:49 > System.map-5.4.10-gentoo-x86_64 > -rw-r--r--  2 root root  3456397 Jan  9 21:48 > System.map-genkernel-x86_64-5.4.2-gentoo > drwxr-xr-x  2 root root     1024 Apr 29  2019 efi > drwxr-xr-x  7 root root     1024 Jan  9 22:50 grub > -rw-r--r--  2 root root  8196820 Jan  9 22:15 initramfs > -rw-r--r--  1 root root 16531780 Oct  9 21:35 > initramfs-5.3.5-gentoo-x86_64.img > -rw-r--r--  2 root root  8196820 Jan  9 22:15 > initramfs-genkernel-x86_64-5.4.2-gentoo > -rw-r--r--  2 root root  6804640 Jan  9 21:48 kernel > -rw-r--r--  2 root root  6804640 Jan  9 21:48 > kernel-genkernel-x86_64-5.4.2-gentoo > drwx------  2 root root    12288 Apr 29  2019 lost+found > -rw-r--r--  1 root root  6759584 Dec  6 20:22 vmlinuz-5.3.5-gentoo-x86_64 > -rw-r--r--  1 root root  6829216 Jan 11 19:49 vmlinuz-5.4.10-gentoo-x86_64 > > > As you can see they are missing from du output: > > 19:56:48 [0] ~ >sudo du -hs /boot/System.map > /boot/System.map-5.3.5-gentoo-x86_64 > /boot/System.map-genkernel-x86_64-5.4.2-gentoo /boot/efi /boot/grub > /boot/initramfs /boot/initramfs-5.3.5-gentoo-x86_64.img > /boot/initramfs-genkernel-x86_64-5.4.2-gentoo /boot/kernel > /boot/kernel-genkernel-x86_64-5.4.2-gentoo /boot/lost+found > /boot/vmlinuz-5.3.5-gentoo-x86_64 > > 3.3M    /boot/System.map > 3.4M    /boot/System.map-5.3.5-gentoo-x86_64 > 1.0K    /boot/efi > 9.7M    /boot/grub > 7.9M    /boot/initramfs > 16M    /boot/initramfs-5.3.5-gentoo-x86_64.img > 6.5M    /boot/kernel > 12K    /boot/lost+found > 6.5M    /boot/vmlinuz-5.3.5-gentoo-x86_64 > > > When I remove the hard link from the arguments the corresponding file > appears in the output: > > 19:56:51 [0] ~ >sudo du -hs /boot/System.map > /boot/System.map-5.3.5-gentoo-x86_64 > /boot/System.map-genkernel-x86_64-5.4.2-gentoo /boot/efi /boot/grub > /boot/initramfs /boot/initramfs-5.3.5-gentoo-x86_64.img > /boot/initramfs-genkernel-x86_64-5.4.2-gentoo > /boot/kernel-genkernel-x86_64-5.4.2-gentoo /boot/lost+found > /boot/vmlinuz-5.3.5-gentoo-x86_64 > > 3.3M    /boot/System.map > 3.4M    /boot/System.map-5.3.5-gentoo-x86_64 > 1.0K    /boot/efi > 9.7M    /boot/grub > 7.9M    /boot/initramfs > 16M    /boot/initramfs-5.3.5-gentoo-x86_64.img > 6.5M    /boot/kernel-genkernel-x86_64-5.4.2-gentoo > 12K    /boot/lost+found > 6.5M    /boot/vmlinuz-5.3.5-gentoo-x86_64 > 19:57:28 [0] ~ > > > > Cheers, > Alex. du(1) should count the actual disc usage, and hard links do not add more to that, so that was actually a bug fix back in coreutils-8.6: https://git.sv.gnu.org/cgit/coreutils.git/commit/?id=efe53cc72b59 Discussion starts here: https://bugs.gnu.org/6557 https://lists.gnu.org/r/bug-coreutils/2010-07/msg00015.html This is intended behavior, and also documented in the Texinfo manual: https://www.gnu.org/software/coreutils/du If two or more hard links point to the same file, only one of the hard links is counted. The file argument order affects which links are counted, and changing the argument order may change the numbers and entries that du outputs. I suggest to use the following option to make du(1) also count hard links if needed: ‘-l’ ‘--count-links’ Count the size of all files, even if they have appeared already (as a hard link). As such, I'm hereby marking this as "not-a-bug", and close the issue in out bug tracker. However, the discussion about this can continue here, of course. Have a nice day, Berny From unknown Tue Aug 19 04:06:42 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 10 Feb 2020 12:24:09 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator