Propagate root-device lookup failures - #357
Draft
Byron wants to merge 4 commits into
Draft
Conversation
A failed root-device lookup was replaced with device ID zero after the parallel traversal rewrite. For a dangling symlink, symlink metadata remained readable but failed the device check, hiding the initialization error and producing a successful exit status. Count the lookup failure on its root, mark that root complete for ordered output, and omit it from traversal. A regression test covers an explicitly supplied dangling symlink with --stay-on-filesystem semantics. Validation: cargo test --all-targets; cargo clippy --all-targets -- -D warnings; cargo fmt --check.
Background traversal replaced failed root-device lookups with device ID zero. Readable root metadata could then be rejected as cross-device while the traversal incorrectly retained a successful error count. Skip roots whose lookup fails and carry their per-root errors in the traversal completion event, restoring the previous statistics and exit status. A regression test covers a dangling symlink root. Validation: cargo test --all-targets; cargo clippy --all-targets -- -D warnings; cargo fmt --check.
Review feedback reported that interleaved parent-first walks share a path-only directory map. Duplicate or overlapping roots can overwrite one another, attaching later descendants to the wrong root and propagating their sizes and counts through the wrong ancestors. Use each root path Arc allocation as a private map discriminator while preserving the public traversal event types. A duplicate-root regression test verifies that each root retains its own child. Validation: cargo test --all-targets; cargo clippy --all-targets -- -D warnings; cargo fmt --check.
Review feedback reported that concurrent aggregate roots race through a shared inode filter. Links to the same inode can therefore be charged to whichever root produces metadata first instead of consistently belonging to the first input root. Consume root walkers in input order when hard links are deduplicated, while retaining batched parallel roots when --count-hard-links makes ownership irrelevant. A regression test places a shared inode behind a deeper first root and verifies that the first root owns its size. Validation: cargo test --all-targets; cargo clippy --all-targets -- -D warnings; cargo fmt --check.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tasks
This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.
Everything below this line was generated by
Codex GPT-5.Created by Codex on behalf of Byron. Byron will review before this is ready to merge.
Reported issue
Propagate root-device lookup failures**
With
--stay-on-filesystem, ifcrossdev::initfails whilesymlink_metadatacan still read the root (for example, an explicitly supplied dangling symlink), replacing the error with device ID 0 causes the valid root metadata to fail the same-device check. The command then reports zero bytes and no I/O error instead of retaining the previous nonzero error count and exit status; the same fallback is also used by background traversal. Treat the initialization failure as a per-root error rather than inventing a device ID.Summary
Validation
cargo test --all-targetscargo clippy --all-targets -- -D warningscargo fmt --check