Skip to content

fix: report a directory listed twice instead of panicking (#260) - #21

Merged
jeiang merged 2 commits into
masterfrom
fix/assemble-missing-branch
Oct 14, 2026
Merged

jeiang merged 2 commits into
masterfrom
fix/assemble-missing-branch

Conversation

@jeiang

@jeiang jeiang commented Oct 14, 2026

Copy link
Copy Markdown
Owner

Upstream solidiquis#260's video shows called Option::unwrap() on a None value at branches.remove(current_node.path()).unwrap() in assemble_tree (src/tree/mod.rs:203 in v3.1.2 and before this PR). Every directory gets exactly one branch entry when it arrives, so a missing entry means the walker reported that directory twice.

Not reproduced: macOS / (6M entries), GitHub Ubuntu kernel 6.17 with sudo on /, /sys, /proc (master and v3.1.2), and a NixOS host on kernel 7.2.4 with sudo on every top-level directory except /mnt (master and v3.1.2) plus 3 pty runs of / with the progress indicator (3.66M lines each). The reporter used Arch on kernel 6.13.1.

This PR does not guess at deduplication (skipping the duplicate would still double-count its children); it turns the panic into erd: The filesystem reported directory '<path>' more than once; please report this at …, exit 1, so the next report contains the offending path.

Unit test tree::test::duplicate_directory_is_an_error feeds the same directory twice into assemble_tree and asserts the error names it (the old signature returned () and panicked here). Local: fmt, clippy (host + Windows cross), full cargo test --locked.

assemble_tree unwrapped the branch entry for every directory. An entry
can only be missing if the walker reported the same directory twice,
which panicked the assembler thread (upstream solidiquis#260). Return
Error::DuplicateDirectory naming the path so the cause is diagnosable.
@jeiang
jeiang enabled auto-merge October 14, 2026 16:05
@jeiang
jeiang merged commit 3858021 into master Oct 14, 2026
15 checks passed
@jeiang
jeiang deleted the fix/assemble-missing-branch branch October 14, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant