Skip to content

Use of -d flag should not change calculated sizes #112

@rylwin

Description

@rylwin

I was giving dust a try and noticed that the use of the -d flag changes the displayed sizes of the directories, whereas I would have expect each directory to be the same size, but with fewer sub-levels displayed. Is this the expected behavior, a bug, or user error?

Here's the output of the dust repo after cloning it, comparing du, dust -bd1, and dust -b (using -b for more readable output below):

$ du -d 1 -h | sort -h
24K	./ci
24K	./.github
52K	./src
68K	./media
84K	./tests
552K	./.git
153M	./target
154M	.

$ cargo run -- -bd1
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
     Running `target/debug/dust -bd1`
 4.0K   ┌── README.md
 4.0K   ├── Cargo.toml
 4.0K   ├── .gitignore
 8.0K   ├── .github
  12K   ├── LICENSE
  16K   ├── target
  24K   ├── ci
  24K   ├── Cargo.lock
  32K   ├── src
  40K   ├── .git
  52K   ├── tests
  68K   ├── media
 292K ┌─┴ .

$ cargo run -- -b  
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/dust -b`
 948K             ┌── query-cache.bin
 3.9M             ├── dep-graph.bin
  10M           ┌─┴ s-fqutna58o2-1mf6920-1dfcidj0qrb4
  10M         ┌─┴ dust-1u7onte9p4g5s
  10M       ┌─┴ incremental
 2.8M       │   ┌── build_script_build-95c8841d5eeef07a
 2.8M       │ ┌─┴ log-95c8841d5eeef07a
 2.8M       │ │ ┌── build_script_build-98b6810859c9cb39
 2.8M       │ ├─┴ memchr-98b6810859c9cb39
 3.1M       │ │ ┌── build-script-build
 3.1M       │ ├─┴ bitflags-5ac1d02a416a61b2
 3.2M       │ │ ┌── build_script_build-9091c386f088b04c
 3.2M       │ ├─┴ libc-9091c386f088b04c
 3.5M       │ │ ┌── build-script-build
 3.5M       │ ├─┴ crossbeam-utils-408f2589721c053b
  15M       ├─┴ build
 912K       │ ┌── libtextwrap-1a0030a681f6ac5d.rlib
 1.0M       │ ├── libregex-818c9001a7df9eb5.rmeta
 1.0M       │ ├── libaho_corasick-39d24709df92682f.rmeta
 1.1M       │ ├── libstrsim-c37e1feb7d72bc60.rlib
 1.3M       │ ├── libnum_cpus-7c7ca82d2b6385a6.rlib
 1.4M       │ ├── liblscolors-d48fed5629317cfd.rlib
 1.5M       │ ├── libbstr-8fff9e7d83cfd68c.rlib
 1.6M       │ ├── libwalkdir-d08a403e2772aeb4.rlib
 1.6M       │ ├── libcrossbeam_utils-4e0e4e297bcafc8b.rlib
 1.6M       │ ├── libautocfg-b11cbca6ecbb3954.rlib
 1.7M       │ ├── liblibc-c64d0ff9390f98b5.rmeta
 1.7M       │ ├── libclap-aeb92d621b503b05.rmeta
 1.8M       │ ├── libcrossbeam_channel-7116bcca9ad76a0b.rlib
 2.0M       │ ├── liblibc-c64d0ff9390f98b5.rlib
 4.9M       │ ├── libaho_corasick-39d24709df92682f.rlib
 5.2M       │ ├── libregex_syntax-d37ef5e024ea9658.rmeta
 6.0M       │ ├── libglobset-3998d750ef9972f8.rlib
 8.8M       │ ├── libignore-92c56c21ac8db7b8.rlib
  10M       │ ├── libregex-818c9001a7df9eb5.rlib
  13M       │ ├── libregex_syntax-d37ef5e024ea9658.rlib
  16M       │ ├── libclap-aeb92d621b503b05.rlib
  31M       │ ├── dust-321965f5bb0f1679
 125M       ├─┴ deps
 152M     ┌─┴ debug
 152M   ┌─┴ target
 153M ┌─┴ .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions