Skip to content

du -BM behaves differently from GNU version #13605

Closed

Description

@svetasmirnova

du -BM does not print unit:

sveta@lemurr:~/src/thirdparty/coreutils$ du --version
du (uutils coreutils) 0.8.0
sveta@lemurr:~/src/thirdparty/coreutils$ du -BM | head
2	./man
1	./.git/refs/heads
1	./.git/refs/tags
1	./.git/refs/remotes/origin
1	./.git/refs/remotes
1	./.git/refs
1	./.git/objects/info
51	./.git/objects/pack
51	./.git/objects
1	./.git/logs/refs/heads

Here is the output of the GNU version:

sveta@lemurr:~/src/thirdparty/coreutils$ ./src/du --version
du (GNU coreutils) 9.11.131-68f15
Copyright (C) 2026 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjörn Granlund, David MacKenzie, Paul Eggert,
and Jim Meyering.
sveta@lemurr:~/src/thirdparty/coreutils$ ./src/du -BM | head
2M	./man
1M	./.git/refs/heads
1M	./.git/refs/tags
1M	./.git/refs/remotes/origin
1M	./.git/refs/remotes
1M	./.git/refs
1M	./.git/objects/info
51M	./.git/objects/pack
51M	./.git/objects
1M	./.git/logs/refs/heads

Activity

  1. sylvestre commented on Jul 27, 2026

    @sylvestre
    SponsorContributor

    still happen on 0.9.0

  2. lauchimoon commented on Jul 30, 2026

    @lauchimoon
    Contributor

    Can confirm this also happens with other size units in latest uu:

    lauren@eviluser7:coreutils $ ./target/debug/du -BK | head
    4       ./target/debug/examples
    20      ./target/debug/.fingerprint/foreign-types-shared-a871f8492b4c2ef7
    20      ./target/debug/.fingerprint/icu_datetime_data-f8601b1edbdee656
    24      ./target/debug/.fingerprint/uu_truncate-34e734ebeffe60f0
    20      ./target/debug/.fingerprint/regex-3286539dd1bba8fb
    24      ./target/debug/.fingerprint/uu_nohup-8953f7b7aa3d317d
    20      ./target/debug/.fingerprint/adler2-cd9a8eb2894be549
    20      ./target/debug/.fingerprint/zerocopy-dd9049e7d865db05
    20      ./target/debug/.fingerprint/anstyle-query-629522025f262aba
    20      ./target/debug/.fingerprint/same-file-c3d42a00f565f4b5
    lauren@eviluser7:coreutils $ ./target/debug/du -BG | head
    1       ./target/debug/examples
    1       ./target/debug/.fingerprint/foreign-types-shared-a871f8492b4c2ef7
    1       ./target/debug/.fingerprint/icu_datetime_data-f8601b1edbdee656
    1       ./target/debug/.fingerprint/uu_truncate-34e734ebeffe60f0
    1       ./target/debug/.fingerprint/regex-3286539dd1bba8fb
    1       ./target/debug/.fingerprint/uu_nohup-8953f7b7aa3d317d
    1       ./target/debug/.fingerprint/adler2-cd9a8eb2894be549
    1       ./target/debug/.fingerprint/zerocopy-dd9049e7d865db05
    1       ./target/debug/.fingerprint/anstyle-query-629522025f262aba
    1       ./target/debug/.fingerprint/same-file-c3d42a00f565f4b5
    

    I suspect it's because of the way convert_size deals with SizeFormat::BlockSize, but I'm not entirely sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions