Skip to content

Propagate root-device lookup failures - #357

Draft
Byron wants to merge 4 commits into
mainfrom
crossdev-fix
Draft

Propagate root-device lookup failures#357
Byron wants to merge 4 commits into
mainfrom
crossdev-fix

Conversation

@Byron

@Byron Byron commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Tasks

This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.

  • refackiew

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, if crossdev::init fails while symlink_metadata can 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

  • Count aggregate root-device initialization failures and preserve ordered output.
  • Propagate background root-device initialization failures through traversal completion.
  • Keep successful background roots compactly indexed when failed roots are skipped.

Validation

  • cargo test --all-targets
  • cargo clippy --all-targets -- -D warnings
  • cargo fmt --check
  • Codex review for each commit hash

codex added 4 commits August 1, 2026 18:48
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.
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.

2 participants