Root path edges: trailing slash self-conflict, stray directory #243

Closed
opened 2026-08-25 10:30:19 +01:00 by naps62-yolo · 0 comments
Owner

Two small filesystem-edge defects in the root relocation, from the integration
review.

A trailing slash makes a root conflict with itself. roots.rs:183 compares
path == current.path as exact strings and neither create nor update
normalises trailing separators. PUT with /mnt/media/ when /mnt/media is
stored takes the relocation branch, every planned destination resolves to its
own source, and the pre-check returns
409 the destination already has '/mnt/media/Dune Part Two (2024) [tmdbid-693134]'
for what the operator sees as a no-op edit.

A failed move leaves an empty directory behind. relocate.rs:166-172 calls
create_dir_all(new_root) and never cleans it up when the move then fails;
roots.rs's own test asserts the leftover exists. §7.4 says a failure "leaves
the root's path alone, so the stored path always describes the disk" — true of
the row, but an empty directory is left at a path no root points at.

Scope: normalise trailing separators before the comparison and before planning,
and remove a directory this request created when the move it was created for
does not complete.

Two small filesystem-edge defects in the root relocation, from the integration review. **A trailing slash makes a root conflict with itself.** `roots.rs:183` compares `path == current.path` as exact strings and neither `create` nor `update` normalises trailing separators. `PUT` with `/mnt/media/` when `/mnt/media` is stored takes the relocation branch, every planned destination resolves to its own source, and the pre-check returns `409 the destination already has '/mnt/media/Dune Part Two (2024) [tmdbid-693134]'` for what the operator sees as a no-op edit. **A failed move leaves an empty directory behind.** `relocate.rs:166-172` calls `create_dir_all(new_root)` and never cleans it up when the move then fails; `roots.rs`'s own test asserts the leftover exists. §7.4 says a failure "leaves the root's path alone, so the stored path always describes the disk" — true of the row, but an empty directory is left at a path no root points at. Scope: normalise trailing separators before the comparison and before planning, and remove a directory this request created when the move it was created for does not complete.
naps62-yolo added this to the Feedback pass 2 milestone 2026-08-25 10:30:19 +01:00
naps62-yolo added the difficulty/easyarea/apitype/bug labels 2026-08-25 10:30:19 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: yolo/arr#243