GNU bug report logs - #49381
v.8.32 – du(1) | Calculating the total size of files | One file covered instead of all

Previous Next

Package: coreutils;

Reported by: Ricky Tigg <ricky.tigg <at> gmail.com>

Date: Sun, 4 Jul 2021 13:55:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 49381 in the body.
You can then email your comments to 49381 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#49381; Package coreutils. (Sun, 04 Jul 2021 13:55:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ricky Tigg <ricky.tigg <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sun, 04 Jul 2021 13:55:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ricky Tigg <ricky.tigg <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: v.8.32 – du(1) | Calculating the total size of files | One file covered instead of all
Date: Sun, 4 Jul 2021 16:54:04 +0300
[Message part 1 (text/plain, inline)]
*OS:* Fedora; Tested in Bash v.5.1.

Hello. Task: Printing total size of files *alone*.
To reproduce:

$ stat -c '%i %h %s %n %F' k l
4198568 2 34 k regular file
4198568 2 34 l regular file

$ find . -type f
./k
./l

Those  'du' commands cover only one file instead of all files.

$ find . -type f -exec du -acb {} +
34 ./k
34 total

$ find . -type f -print0 | du --files0-from=- -cb
34 ./k
34 total

Isn't rather *68* expected?
[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#49381; Package coreutils. (Sun, 04 Jul 2021 14:36:01 GMT) Full text and rfc822 format available.

Message #8 received at 49381 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Golden <gdg <at> zplane.com>
To: Ricky Tigg <ricky.tigg <at> gmail.com>
Cc: 49381 <at> debbugs.gnu.org
Subject: Re: bug#49381: v.8.32 – du(1) | Calculating the total size of files | One
 file covered instead of all
Date: Sun, 4 Jul 2021 08:35:12 -0600
Ricky Tigg <ricky.tigg <at> gmail.com> [2021-07-04 16:54:04 +0300]:
> *OS:* Fedora; Tested in Bash v.5.1.
> 
> Hello. Task: Printing total size of files *alone*.
> To reproduce:
> 
> $ stat -c '%i %h %s %n %F' k l
> 4198568 2 34 k regular file
> 4198568 2 34 l regular file
> 
> $ find . -type f
> ./k
> ./l
> 
> Those  'du' commands cover only one file instead of all files.
> 
> $ find . -type f -exec du -acb {} +
> 34 ./k
> 34 total
> 
> $ find . -type f -print0 | du --files0-from=- -cb
> 34 ./k
> 34 total
> 
> Isn't rather *68* expected?

You probably want to specify --count-links if you want hardlinked files
(like your example k and l) to be considered by du as separate files:

    $ echo foo > k
    $ ln k l


    $ du -c k l
    4       k
    4       total

    $ du -c --count-links k l
    4       k
    4       l
    8       total




Information forwarded to bug-coreutils <at> gnu.org:
bug#49381; Package coreutils. (Sun, 04 Jul 2021 18:12:01 GMT) Full text and rfc822 format available.

Message #11 received at 49381 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: gdg <at> zplane.com, Ricky Tigg <ricky.tigg <at> gmail.com>
Cc: 49381 <at> debbugs.gnu.org
Subject: Re: bug#49381: v.8.32 – du(1) | Calculating the total size of files | One file covered instead of all
Date: Sun, 4 Jul 2021 11:11:17 -0700
On 7/4/21 7:35 AM, Glenn Golden wrote:
> You probably want to specify --count-links if you want hardlinked files
> (like your example k and l) to be considered by du as separate files:

Yes, that's right. Closing the bug report.




bug closed, send any further explanations to 49381 <at> debbugs.gnu.org and Ricky Tigg <ricky.tigg <at> gmail.com> Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Thu, 10 Feb 2022 19:10:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 11 Mar 2022 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 47 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.