Skip to content

[BUG] Ubuntu 25.10 / Mole CLI (Linux) 0.6.0: Home counts cross-directory hard links twice #2013

Closed

Description

@r266-tech

Environment

  • Mole CLI (Linux) 0.6.0, current linux@4de579cc3de36063880ab3e53e5af2587d2bfca9.
  • Ubuntu 25.10, aarch64, ordinary user in an OrbStack VM.
  • Reproduced with both uutils du 0.2.2 and GNU du 9.5.

Reproduction

Use a temporary HOME so no real user files are involved:

fixture=$(mktemp -d)
mkdir -p "$fixture/Documents" "$fixture/Projects"
dd if=/dev/zero of="$fixture/Documents/original.bin" bs=1048576 count=1 status=none
ln "$fixture/Documents/original.bin" "$fixture/Projects/linked.bin"
HOME="$fixture" mo analyze --json
# Inspect the entry whose name is Home.

The Home entry reports 2097152 bytes, although the two names refer to one 1 MiB file. One GNU du -skP --exclude=.cache "$fixture" reports 1024 KiB. The equivalent unchanged Analyze binary, built from the exact source above and run with --json on Linux, produced this Home row (temporary path omitted):

{"scan_status":"complete","name":"Home","size":2097152,"is_dir":true}

A focused test through measureOverviewSize and the Home JSON pipeline reports the same 2097152 B with either du implementation. The ordinary directory scanner's non-.cache entries total 1048576 B for the same links. The test used real hard links, with the production scanner unchanged.

Cause and scope

getDirectorySizeFromDuSkippingImmediateChild omits the immediate ~/.cache, then launches an independent du for each remaining child. Each process has its own hardlink set. A link directly in Home and another under a child has the same problem because direct files are added separately.

The deduplication needs to span the whole included Home measurement while still excluding only the immediate .cache, preserving nested caches and the Linux mount/snapshot rules. This differs from the Windows NTFS issue #2011/#2012. I am investigating the corresponding macOS Home path separately; this report concerns the Linux consumer.

The current Linux CONTRIBUTING.md asks for issues rather than PRs, so this is a reproduction report. No cleanup or real authorization was performed. AI assistance was used for the investigation and verification.

Activity

  1. tw93 commented on Nov 16, 2026

    @tw93
    Owner

    @r266-tech Thanks for the clean reproduction with both du builds. This is fixed on the linux branch: the Home row now counts a file once when its hard links sit in different children or directly in Home, and nested .cache folders are still counted.

    Linux does it differently from #2014. uutils du 0.2.2 still counts links once per operand even inside one du -c, so the Linux CLI runs a single du over Home and leaves out only the literal ~/.cache path. Older cached Home totals are discarded.

    It is in Nightly now and will be in the next Linux release:

    mo update --nightly
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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions